mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 19:53:27 +01:00
Fix off-by-one errors in use of IsFinalTx()
Previously CreateNewBlock() didn't take into account the fact that IsFinalTx() without any arguments tests if the transaction is considered final in the *current* block, when both those functions really needed to know if the transaction would be final in the *next* block. Additionally the UI had a similar misunderstanding. Also adds some basic tests to check that CreateNewBlock() is in fact mining nLockTime-using transactions correctly. Thanks to Wladimir J. van der Laan for rebase.
This commit is contained in:
@@ -20,10 +20,10 @@
|
||||
|
||||
QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
|
||||
{
|
||||
if (!IsFinalTx(wtx))
|
||||
if (!IsFinalTx(wtx, chainActive.Height() + 1))
|
||||
{
|
||||
if (wtx.nLockTime < LOCKTIME_THRESHOLD)
|
||||
return tr("Open for %n more block(s)", "", wtx.nLockTime - chainActive.Height() + 1);
|
||||
return tr("Open for %n more block(s)", "", wtx.nLockTime - chainActive.Height());
|
||||
else
|
||||
return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.nLockTime));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user