diff --git a/lib/TransactionDb.js b/lib/TransactionDb.js index c2f2d78..f7c1de9 100644 --- a/lib/TransactionDb.js +++ b/lib/TransactionDb.js @@ -391,7 +391,7 @@ TransactionDb.prototype.cacheConfirmations = function(txouts, cb) { TransactionDb.prototype.cacheScriptPubKey = function(txouts, cb) { - // console.log('[TransactionDb.js.381:cacheScriptPubKey:]'); //TODO + console.log('[TransactionDb.js.381:cacheScriptPubKey:]'); //TODO var self = this; var dbScript = []; for (var ii in txouts) { @@ -560,9 +560,11 @@ TransactionDb.prototype.getStandardizedTx = function(tx, time, isCoinBase) { TransactionDb.prototype.fillScriptPubKey = function(txouts, cb) { var self = this; + var allCached = true; // Complete utxo info async.eachLimit(txouts, CONCURRENCY, function(txout, a_c) { if (txout.scriptPubKeyCached) return a_c(); + allCached = false; self.fromIdInfoSimple(txout.txid, function(err, info) { if (!info || !info.vout) return a_c(err); @@ -571,7 +573,8 @@ TransactionDb.prototype.fillScriptPubKey = function(txouts, cb) { return a_c(); }); }, function() { - self.cacheScriptPubKey(txouts, cb); + if (!allCached) + self.cacheScriptPubKey(txouts, cb); }); };