Fixes importing profile with a wallet that is not ready

This commit is contained in:
Matias Pando 2014-11-17 11:46:15 -03:00
commit b9fd442ffd
2 changed files with 4 additions and 3 deletions

View file

@ -363,7 +363,7 @@ Identity.importFromFullJson = function(str, password, opts, cb) {
json.wallets = json.wallets || {}; json.wallets = json.wallets || {};
async.map(json.wallets, function(walletData, callback) { async.map(json.wallets, function(walletData, callback) {
if (!walletData) if (!walletData)
return callback(); return callback();
iden.importWalletFromObj(walletData, opts, function(err, w) { iden.importWalletFromObj(walletData, opts, function(err, w) {

View file

@ -2488,15 +2488,16 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, comment, utxos
/** /**
* @desc Updates all the indexes for the current publicKeyRing. This scans * @desc Updates all the indexes for the current publicKeyRing. This scans
* the blockchain looking for transactions on derived addresses. * the blockchain looking for transactions on derived addresses.
* *
* Triggers a wallet {@link Wallet#store} call * Triggers a wallet {@link Wallet#store} call
* @param {Function} callback - called when all indexes have been updated. Receives an error, if any, as first argument * @param {Function} callback - called when all indexes have been updated. Receives an error, if any, as first argument
*/ */
Wallet.prototype.updateIndexes = function(callback) { Wallet.prototype.updateIndexes = function(callback) {
var self = this; var self = this;
if (!self.isReady())
return callback();
log.debug('Wallet:' + this.id + ' Updating indexes...'); log.debug('Wallet:' + this.id + ' Updating indexes...');
var tasks = this.publicKeyRing.indexes.map(function(index) { var tasks = this.publicKeyRing.indexes.map(function(index) {
return function(callback) { return function(callback) {
self.updateIndex(index, callback); self.updateIndex(index, callback);