Browse Source

Merge pull request #2159 from petertodd/display-nlocktime-correctly

Display tx nLockTime correctly when set to block #
miguelfreitas
Gavin Andresen 12 years ago
parent
commit
e4f2b6b08f
  1. 2
      src/qt/transactiondesc.cpp
  2. 2
      src/qt/transactionrecord.cpp
  3. 4
      src/qt/transactionrecord.h
  4. 2
      src/qt/transactiontablemodel.cpp

2
src/qt/transactiondesc.cpp

@ -14,7 +14,7 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
if (!wtx.IsFinal()) if (!wtx.IsFinal())
{ {
if (wtx.nLockTime < LOCKTIME_THRESHOLD) if (wtx.nLockTime < LOCKTIME_THRESHOLD)
return tr("Open for %n block(s)", "", nBestHeight - wtx.nLockTime); return tr("Open for %n more block(s)", "", wtx.nLockTime - nBestHeight + 1);
else else
return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.nLockTime)); return tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx.nLockTime));
} }

2
src/qt/transactionrecord.cpp

@ -167,7 +167,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
if (wtx.nLockTime < LOCKTIME_THRESHOLD) if (wtx.nLockTime < LOCKTIME_THRESHOLD)
{ {
status.status = TransactionStatus::OpenUntilBlock; status.status = TransactionStatus::OpenUntilBlock;
status.open_for = nBestHeight - wtx.nLockTime; status.open_for = wtx.nLockTime - nBestHeight + 1;
} }
else else
{ {

4
src/qt/transactionrecord.h

@ -47,7 +47,9 @@ public:
@{*/ @{*/
Status status; Status status;
int64 depth; int64 depth;
int64 open_for; /**< Timestamp if status==OpenUntilDate, otherwise number of blocks */ int64 open_for; /**< Timestamp if status==OpenUntilDate, otherwise number
of additional blocks that need to be mined before
finalization */
/**@}*/ /**@}*/
/** Current number of blocks (to know whether cached status is still valid) */ /** Current number of blocks (to know whether cached status is still valid) */

2
src/qt/transactiontablemodel.cpp

@ -280,7 +280,7 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
switch(wtx->status.status) switch(wtx->status.status)
{ {
case TransactionStatus::OpenUntilBlock: case TransactionStatus::OpenUntilBlock:
status = tr("Open for %n block(s)","",wtx->status.open_for); status = tr("Open for %n more block(s)","",wtx->status.open_for);
break; break;
case TransactionStatus::OpenUntilDate: case TransactionStatus::OpenUntilDate:
status = tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx->status.open_for)); status = tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx->status.open_for));

Loading…
Cancel
Save