fixing tests

This commit is contained in:
Manuel Araoz 2014-05-29 16:17:17 -03:00
commit 4cd90c45a2
4 changed files with 8 additions and 4 deletions

View file

@ -7,7 +7,7 @@ var HK = bitcore.HierarchicalKey;
var WalletKey = bitcore.WalletKey; var WalletKey = bitcore.WalletKey;
var networks = bitcore.networks; var networks = bitcore.networks;
var util = bitcore.util; var util = bitcore.util;
var PublicKeyRing = require('./PublicKeyRing'); var PublicKeyRing = require('./PublicKeyRing');
function PrivateKey(opts) { function PrivateKey(opts) {
opts = opts || {}; opts = opts || {};
@ -62,6 +62,7 @@ PrivateKey.prototype._getHK = function(path) {
}; };
PrivateKey.prototype.get = function(index,isChange) { PrivateKey.prototype.get = function(index,isChange) {
console.log(PublicKeyRing);
var path = PublicKeyRing.FullBranch(index, isChange); var path = PublicKeyRing.FullBranch(index, isChange);
var pk = this.privateKeyCache[path]; var pk = this.privateKeyCache[path];
if (!pk) { if (!pk) {

View file

@ -5,6 +5,7 @@
var imports = require('soop').imports(); var imports = require('soop').imports();
var bitcore = require('bitcore'); var bitcore = require('bitcore');
var HK = bitcore.HierarchicalKey; var HK = bitcore.HierarchicalKey;
var PrivateKey = require('./PrivateKey');
var Address = bitcore.Address; var Address = bitcore.Address;
var Script = bitcore.Script; var Script = bitcore.Script;
var coinUtil = bitcore.util; var coinUtil = bitcore.util;
@ -127,7 +128,8 @@ PublicKeyRing.prototype._checkKeys = function() {
}; };
PublicKeyRing.prototype._newExtendedPublicKey = function () { PublicKeyRing.prototype._newExtendedPublicKey = function () {
return new HK(this.network.name) return new PrivateKey({networkName: this.network.name})
.deriveBIP45Branch()
.extendedPublicKeyString(); .extendedPublicKeyString();
}; };

View file

@ -42,7 +42,7 @@ var createPKR = function (bip32s) {
for(var i=0; i<5; i++) { for(var i=0; i<5; i++) {
if (bip32s) { if (bip32s) {
var b=bip32s[i]; var b=bip32s[i];
w.addCopayer(b?b.getExtendedPublicKeyString():null); w.addCopayer(b?b.deriveBIP45Branch().extendedPublicKeyString():null);
} }
else else
w.addCopayer(); w.addCopayer();
@ -72,7 +72,7 @@ describe('TxProposals model', function() {
var priv = new PrivateKey(config); var priv = new PrivateKey(config);
var priv2 = new PrivateKey(config); var priv2 = new PrivateKey(config);
var priv3 = new PrivateKey(config); var priv3 = new PrivateKey(config);
var ts = Date.now(); var ts = Date.now();
var isChange=0; var isChange=0;
var index=0; var index=0;
var pkr = createPKR([priv, priv2, priv3]); var pkr = createPKR([priv, priv2, priv3]);

View file

@ -132,6 +132,7 @@ describe('Wallet model', function() {
); );
var t = w.txProposals; var t = w.txProposals;
console.log(t);
var k = Object.keys(t.txps)[0]; var k = Object.keys(t.txps)[0];
var tx = t.txps[k].builder.build(); var tx = t.txps[k].builder.build();
should.exist(tx); should.exist(tx);