Merge pull request #90 from cmgustavo/bug/read-backup

Bug/read backup
This commit is contained in:
Manuel Aráoz 2014-04-18 11:29:09 -03:00
commit e50f4b1c31
3 changed files with 4 additions and 5 deletions

View file

@ -129,10 +129,9 @@ PublicKeyRing.prototype.getPubKeys = function (index, isChange) {
var bip32 = this.copayersBIP32[i].derive(path); var bip32 = this.copayersBIP32[i].derive(path);
pubKeys[i] = bip32.eckey.public; pubKeys[i] = bip32.eckey.public;
} }
this.publicKeysCache[path] = pubKeys; this.publicKeysCache[path] = pubKeys.map(function(pk){return pk.toString('hex')});
//console.log('cache fill['+path+']='+pubKeys.length);
} else { } else {
//console.log('cache hit!'); pubKeys = pubKeys.map(function(s){return new Buffer(s,'hex')});
} }
return pubKeys; return pubKeys;
@ -157,7 +156,6 @@ PublicKeyRing.prototype.getRedeemScript = function (index, isChange) {
PublicKeyRing.prototype.getAddress = function (index, isChange) { PublicKeyRing.prototype.getAddress = function (index, isChange) {
this._checkIndexRange(index, isChange); this._checkIndexRange(index, isChange);
var script = this.getRedeemScript(index,isChange); var script = this.getRedeemScript(index,isChange);
return Address.fromScript(script, this.network.name); return Address.fromScript(script, this.network.name);
}; };

View file

@ -222,6 +222,7 @@ Wallet.prototype.sendPublicKeyRing = function(recipients) {
Wallet.prototype.generateAddress = function() { Wallet.prototype.generateAddress = function() {
var addr = this.publicKeyRing.generateAddress(); var addr = this.publicKeyRing.generateAddress();
this.sendPublicKeyRing(); this.sendPublicKeyRing();
this.store();
return addr; return addr;
}; };

View file

@ -40,7 +40,7 @@ angular.module('copay.controllerUtils').factory('controllerUtils', function ($ro
}); });
w.on('refresh', function() { w.on('refresh', function() {
console.log('[controllerUtils.js] Refreshing'); //TODO console.log('[controllerUtils.js] Refreshing'); //TODO
$rootScope.$digest(); // Do not use $digest() here.
}); });
w.on('openError', root.onErrorDigest); w.on('openError', root.onErrorDigest);
w.on('close', root.onErrorDigest); w.on('close', root.onErrorDigest);