added performance improvement suggestion by @eordano

This commit is contained in:
Ivan Socolsky 2014-11-20 14:29:47 -03:00
parent 5b922915e7
commit d76c9f0a7a
1 changed files with 4 additions and 1 deletions

View File

@ -108,11 +108,14 @@ exports.multitxs = function(req, res, next) {
txs = txs.slice(start, end); txs = txs.slice(start, end);
} }
var txIndex = {};
_.each(txs, function (tx) { txIndex[tx.txid] = tx; });
async.each(txs, function (tx, callback) { async.each(txs, function (tx, callback) {
tDb.fromIdWithInfo(tx.txid, function(err, tx) { tDb.fromIdWithInfo(tx.txid, function(err, tx) {
if (err) console.log(err); if (err) console.log(err);
if (tx && tx.info) { if (tx && tx.info) {
_.find(txs, { txid: tx.txid }).info = tx.info; txIndex[tx.txid].info = tx.info;
} }
callback(); callback();
}); });