aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorPeter Todd <pete@petertodd.org>2015-05-25 00:48:33 -0400
committerWladimir J. van der Laan <laanwj@gmail.com>2015-06-01 12:35:49 +0200
commit75a4d512cfc9a451fa627a3487ffed102cc67cab (patch)
tree92c36e64aab3c9fcc553388016536a09afb38ae6 /src/qt
parent2be094eeba976366f19fc0ca839519335a729919 (diff)
downloadbitcoin-75a4d512cfc9a451fa627a3487ffed102cc67cab.tar.xz
Fix off-by-one error w/ nLockTime in the wallet
Previously due to an off-by-one error the wallet ignored nLockTime-by-height transactions that would be valid in the next block even though they are accepted into the mempool. The transactions wouldn't show up until confirmed, nor would they be included in the unconfirmed balance. Similar to the mempool behavior fix in 665bdd3b, the wallet code was calling IsFinalTx() directly without taking into account the fact that doing so tells you if the transaction could have been mined in the *current* block, rather than the next block. To fix this we strip IsFinalTx() of non-consensus-critical functionality, removing the default arguments, and add CheckFinalTx() to check if a transaction will be final in the next block. Github-Pull: #6183 Rebased-From: 28bf06236d3b385e95fe26a7a742395b30efd6ee
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/transactiondesc.cpp2
-rw-r--r--src/qt/transactionrecord.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp
index 4fffd03adf..5662b16657 100644
--- a/src/qt/transactiondesc.cpp
+++ b/src/qt/transactiondesc.cpp
@@ -26,7 +26,7 @@ using namespace std;
QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
{
AssertLockHeld(cs_main);
- if (!IsFinalTx(wtx, chainActive.Height() + 1))
+ if (!CheckFinalTx(wtx))
{
if (wtx.nLockTime < LOCKTIME_THRESHOLD)
return tr("Open for %n more block(s)", "", wtx.nLockTime - chainActive.Height());
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp
index 7f1db58e5d..15d13e9fc9 100644
--- a/src/qt/transactionrecord.cpp
+++ b/src/qt/transactionrecord.cpp
@@ -188,7 +188,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
status.depth = wtx.GetDepthInMainChain();
status.cur_num_blocks = chainActive.Height();
- if (!IsFinalTx(wtx, chainActive.Height() + 1))
+ if (!CheckFinalTx(wtx))
{
if (wtx.nLockTime < LOCKTIME_THRESHOLD)
{