From f642fd9dd6924472aba42ca324be9515690c59ad Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 20 Feb 2014 14:09:09 +0100 Subject: qt: Modernize 'confirmed' terminology in shown tx status These days we regard transactions with one confirmation to be 'Confirmed'. Waiting for 6 confirmations is a recommendation but should not keep the transaction shown as unconfirmed. Misc code sanity: - Merge maturity/status enums, they had become completely disjunct - 'confirmed' flag is now called 'countsForBalance' for clarity --- src/qt/transactionrecord.cpp | 59 +++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 28 deletions(-) (limited to 'src/qt/transactionrecord.cpp') diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 8cfaed27c7..703a2b4e79 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -164,7 +164,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) (wtx.IsCoinBase() ? 1 : 0), wtx.nTimeReceived, idx); - status.confirmed = wtx.IsTrusted(); + status.countsForBalance = wtx.IsTrusted() && !(wtx.GetBlocksToMaturity() > 0); status.depth = wtx.GetDepthInMainChain(); status.cur_num_blocks = chainActive.Height(); @@ -181,33 +181,12 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) status.open_for = wtx.nLockTime; } } - else - { - if (status.depth < 0) - { - status.status = TransactionStatus::Conflicted; - } - else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0) - { - status.status = TransactionStatus::Offline; - } - else if (status.depth < NumConfirmations) - { - status.status = TransactionStatus::Unconfirmed; - } - else - { - status.status = TransactionStatus::HaveConfirmations; - } - } - // For generated transactions, determine maturity - if(type == TransactionRecord::Generated) + else if(type == TransactionRecord::Generated) { - int64_t nCredit = wtx.GetCredit(true); - if (nCredit == 0) + if (wtx.GetBlocksToMaturity() > 0) { - status.maturity = TransactionStatus::Immature; + status.status = TransactionStatus::Immature; if (wtx.IsInMainChain()) { @@ -215,18 +194,42 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) // Check if the block was requested by anyone if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0) - status.maturity = TransactionStatus::MaturesWarning; + status.status = TransactionStatus::MaturesWarning; } else { - status.maturity = TransactionStatus::NotAccepted; + status.status = TransactionStatus::NotAccepted; } } else { - status.maturity = TransactionStatus::Mature; + status.status = TransactionStatus::Confirmed; + } + } + else + { + if (status.depth < 0) + { + status.status = TransactionStatus::Conflicted; + } + else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0) + { + status.status = TransactionStatus::Offline; + } + else if (status.depth == 0) + { + status.status = TransactionStatus::Unconfirmed; + } + else if (status.depth < RecommendedNumConfirmations) + { + status.status = TransactionStatus::Confirming; + } + else + { + status.status = TransactionStatus::Confirmed; } } + } bool TransactionRecord::statusUpdateNeeded() -- cgit v1.2.3