use scriptPubKeyCached!
This commit is contained in:
parent
fe4c7fac8d
commit
d1fb951aef
@ -391,7 +391,7 @@ TransactionDb.prototype.cacheConfirmations = function(txouts, cb) {
|
|||||||
|
|
||||||
|
|
||||||
TransactionDb.prototype.cacheScriptPubKey = 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 self = this;
|
||||||
var dbScript = [];
|
var dbScript = [];
|
||||||
for (var ii in txouts) {
|
for (var ii in txouts) {
|
||||||
@ -560,9 +560,11 @@ TransactionDb.prototype.getStandardizedTx = function(tx, time, isCoinBase) {
|
|||||||
|
|
||||||
TransactionDb.prototype.fillScriptPubKey = function(txouts, cb) {
|
TransactionDb.prototype.fillScriptPubKey = function(txouts, cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var allCached = true;
|
||||||
// Complete utxo info
|
// Complete utxo info
|
||||||
async.eachLimit(txouts, CONCURRENCY, function(txout, a_c) {
|
async.eachLimit(txouts, CONCURRENCY, function(txout, a_c) {
|
||||||
if (txout.scriptPubKeyCached) return a_c();
|
if (txout.scriptPubKeyCached) return a_c();
|
||||||
|
allCached = false;
|
||||||
|
|
||||||
self.fromIdInfoSimple(txout.txid, function(err, info) {
|
self.fromIdInfoSimple(txout.txid, function(err, info) {
|
||||||
if (!info || !info.vout) return a_c(err);
|
if (!info || !info.vout) return a_c(err);
|
||||||
@ -571,7 +573,8 @@ TransactionDb.prototype.fillScriptPubKey = function(txouts, cb) {
|
|||||||
return a_c();
|
return a_c();
|
||||||
});
|
});
|
||||||
}, function() {
|
}, function() {
|
||||||
self.cacheScriptPubKey(txouts, cb);
|
if (!allCached)
|
||||||
|
self.cacheScriptPubKey(txouts, cb);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user