skip double spends in /txs

This commit is contained in:
Matias Alejo Garcia 2015-07-14 17:06:02 -03:00
parent 2a872dd511
commit c5c23dfa48

View File

@ -161,13 +161,18 @@ exports.multitxs = function(req, res, next) {
} }
if (tx && tx.info) { if (tx && tx.info) {
txIndex[tx.txid].info = tx.info; txIndex[tx.txid].info = tx.info;
} } else
nbTxs--;
callback(); callback();
}); });
}, function(err) { }, function(err) {
if (err) return cb(err); if (err) return cb(err);
var transactions = _.pluck(txs, 'info'); // It could be that a txid is stored at an address but it is
// no longer at bitcoind (for example a double spend)
var transactions = _.compact(_.pluck(txs, 'info'));
transactions = { transactions = {
totalItems: nbTxs, totalItems: nbTxs,
from: +from, from: +from,