Browse Source

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
0.8
Peter Todd 11 years ago committed by Warren Togami
parent
commit
3a67c1ff27
  1. 4
      src/qt/transactiondesc.cpp
  2. 4
      src/qt/transactionrecord.cpp

4
src/qt/transactiondesc.cpp

@ -16,10 +16,10 @@
QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx) QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
{ {
if (!wtx.IsFinal()) if (!wtx.IsFinal(nBestHeight + 1))
{ {
if (wtx.nLockTime < LOCKTIME_THRESHOLD) 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 else
return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.nLockTime)); return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.nLockTime));
} }

4
src/qt/transactionrecord.cpp

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

Loading…
Cancel
Save