From 1224ac08d2adf0d78ecd15971f21a7809d9e890c Mon Sep 17 00:00:00 2001 From: devlo Date: Sun, 28 Sep 2014 00:23:52 +0200 Subject: [PATCH] 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 --- lib/BlockDb.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/BlockDb.js b/lib/BlockDb.js index ed8e62d..c83761a 100644 --- a/lib/BlockDb.js +++ b/lib/BlockDb.js @@ -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();