index for output spend matching (speeds ups tx api

This commit is contained in:
Matias Alejo Garcia 2014-02-10 14:10:49 -03:00
parent 7496fc47de
commit 280f815f97
1 changed files with 9 additions and 2 deletions

View File

@ -103,8 +103,15 @@ function spec(b) {
assert(typeof j !== 'undefined','Spent could not be stored: tx ' + txid +
'spend in TX:' + k[2] + ',' + k[3]+ ' j:' + j);
ret[j].spendTxId = v[0];
ret[j].spendIndex = parseInt(v[1]);
/// TODO Handle multiple addresses here!
if (ret[j].spendTxId) {
// double spend!
assert(0);
}
else {
ret[j].spendTxId = v[0];
ret[j].spendIndex = parseInt(v[1]);
}
})
.on('error', function (err) {
return cb(err);