diff --git a/js/models/Identity.js b/js/models/Identity.js index f516ce1e6..b292854d0 100644 --- a/js/models/Identity.js +++ b/js/models/Identity.js @@ -363,7 +363,7 @@ Identity.importFromFullJson = function(str, password, opts, cb) { json.wallets = json.wallets || {}; async.map(json.wallets, function(walletData, callback) { - if (!walletData) + if (!walletData) return callback(); iden.importWalletFromObj(walletData, opts, function(err, w) { diff --git a/js/models/Wallet.js b/js/models/Wallet.js index f8cc9875b..2aedd8819 100644 --- a/js/models/Wallet.js +++ b/js/models/Wallet.js @@ -2488,15 +2488,16 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, comment, utxos /** * @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 * @param {Function} callback - called when all indexes have been updated. Receives an error, if any, as first argument */ Wallet.prototype.updateIndexes = function(callback) { var self = this; + if (!self.isReady()) + return callback(); log.debug('Wallet:' + this.id + ' Updating indexes...'); - var tasks = this.publicKeyRing.indexes.map(function(index) { return function(callback) { self.updateIndex(index, callback);