From 3a67c1ff27aaf6a18ffe629ba7c9d2b762fcd320 Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Sun, 26 Jan 2014 21:50:15 -0500 Subject: [PATCH] Partial: Fix off-by-one errors in use of IsFinalTx() Conflicts: src/main.cpp src/miner.cpp src/qt/transactiondesc.cpp src/qt/transactionrecord.cpp Rebased-from: 3f25f26edcc41b22130c5845024b86a9b1aa6183 0.8.x --- src/qt/transactiondesc.cpp | 4 ++-- src/qt/transactionrecord.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index 948476205..15ffc336f 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -16,10 +16,10 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx) { - if (!wtx.IsFinal()) + if (!wtx.IsFinal(nBestHeight + 1)) { if (wtx.nLockTime < LOCKTIME_THRESHOLD) - return tr("Open for %n more block(s)", "", wtx.nLockTime - nBestHeight + 1); + return tr("Open for %n more block(s)", "", wtx.nLockTime - nBestHeight); else return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.nLockTime)); } diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index c8d6fcbe6..0c29e5443 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -166,12 +166,12 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) status.depth = wtx.GetDepthInMainChain(); status.cur_num_blocks = nBestHeight; - if (!wtx.IsFinal()) + if (!wtx.IsFinal(nBestHeight + 1)) { if (wtx.nLockTime < LOCKTIME_THRESHOLD) { status.status = TransactionStatus::OpenUntilBlock; - status.open_for = wtx.nLockTime - nBestHeight + 1; + status.open_for = wtx.nLockTime - nBestHeight; } else {