Merge pull request #338 from matiu/bug/handle-double-spend-in-history

skip double spends in /txs
This commit is contained in:
Gustavo Maximiliano Cortez 2015-07-14 17:11:22 -03:00
commit b799cc7d6d

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,