Bug fix for #199

Proper way of counting confirmed transactions is : Height of longest chain - Height of chain for the block containing the transaction + 1
This commit is contained in:
devlo 2014-09-28 00:23:52 +02:00
parent 9764a1d423
commit 1224ac08d2

View File

@ -335,7 +335,7 @@ BlockDb.prototype._fillConfirmationsOneSpent = function(o, chainHeight, cb) {
o.spentTxId = oi.spentTxId;
o.index = oi.index;
o.spentIsConfirmed = chainHeight >= height;
o.spentConfirmations = chainHeight - height;
o.spentConfirmations = chainHeight - height +1;
}
return e_c();
});
@ -345,7 +345,7 @@ BlockDb.prototype._fillConfirmationsOneSpent = function(o, chainHeight, cb) {
if (err) return cb(err);
if (height >=0 ) {
o.spentIsConfirmed = chainHeight >= height;
o.spentConfirmations = chainHeight - height;
o.spentConfirmations = chainHeight - height +1;
}
return cb();
});
@ -358,7 +358,7 @@ BlockDb.prototype._fillConfirmationsOne = function(o, chainHeight, cb) {
if (err) return cb(err);
if (height>=0) {
o.isConfirmed = chainHeight >= height;
o.confirmations = chainHeight - height;
o.confirmations = chainHeight - height +1;
return self._fillConfirmationsOneSpent(o,chainHeight,cb);
}
else return cb();