Merge pull request #2342

665bdd3 Fix off-by-one errors in use of IsFinalTx() (Peter Todd)
This commit is contained in:
Wladimir J. van der Laan
2014-01-27 10:15:18 +01:00
5 changed files with 73 additions and 7 deletions

View File

@@ -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));
}

View File

@@ -168,12 +168,12 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
status.depth = wtx.GetDepthInMainChain();
status.cur_num_blocks = chainActive.Height();
if (!IsFinalTx(wtx))
if (!IsFinalTx(wtx, chainActive.Height() + 1))
{
if (wtx.nLockTime < LOCKTIME_THRESHOLD)
{
status.status = TransactionStatus::OpenUntilBlock;
status.open_for = wtx.nLockTime - chainActive.Height() + 1;
status.open_for = wtx.nLockTime - chainActive.Height();
}
else
{