mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
gui: add assumed confirmed state
Create a separate status for transactions that are confirmed in a block that is assumed valid pending background validation. Use the same icon as for transactions with a single confirmation.
This commit is contained in:
parent
a6c53bb244
commit
3e281590c7
4 changed files with 33 additions and 25 deletions
6
doc/release-notes-28616.md
Normal file
6
doc/release-notes-28616.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
GUI changes
|
||||||
|
------
|
||||||
|
|
||||||
|
- Transactions that are confirmed while assume utxo background sync is in progress,
|
||||||
|
will have a clock icon and a tooltip explaining that historical blocks are still
|
||||||
|
being verified. (#28616)
|
|
@ -175,42 +175,31 @@ void TransactionRecord::updateStatus(const interfaces::WalletTxStatus& wtx, cons
|
||||||
|
|
||||||
// For generated transactions, determine maturity
|
// For generated transactions, determine maturity
|
||||||
if (type == TransactionRecord::Generated) {
|
if (type == TransactionRecord::Generated) {
|
||||||
if (wtx.blocks_to_maturity > 0)
|
if (wtx.blocks_to_maturity > 0) {
|
||||||
{
|
|
||||||
status.status = TransactionStatus::Immature;
|
status.status = TransactionStatus::Immature;
|
||||||
|
|
||||||
if (wtx.is_in_main_chain)
|
if (wtx.is_in_main_chain) {
|
||||||
{
|
|
||||||
status.matures_in = wtx.blocks_to_maturity;
|
status.matures_in = wtx.blocks_to_maturity;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
status.status = TransactionStatus::NotAccepted;
|
status.status = TransactionStatus::NotAccepted;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
status.status = TransactionStatus::Confirmed;
|
status.status = TransactionStatus::Confirmed;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if (status.depth < 0) {
|
||||||
{
|
|
||||||
if (status.depth < 0)
|
|
||||||
{
|
|
||||||
status.status = TransactionStatus::Conflicted;
|
status.status = TransactionStatus::Conflicted;
|
||||||
}
|
}
|
||||||
else if (status.depth == 0)
|
else if (status.depth == 0) {
|
||||||
{
|
|
||||||
status.status = TransactionStatus::Unconfirmed;
|
status.status = TransactionStatus::Unconfirmed;
|
||||||
if (wtx.is_abandoned)
|
if (wtx.is_abandoned) {
|
||||||
status.status = TransactionStatus::Abandoned;
|
status.status = TransactionStatus::Abandoned;
|
||||||
}
|
}
|
||||||
else if (status.depth < RecommendedNumConfirmations)
|
} else if (wtx.is_assumed) {
|
||||||
{
|
status.status = TransactionStatus::AssumedConfirmed;
|
||||||
|
} else if (status.depth < RecommendedNumConfirmations) {
|
||||||
status.status = TransactionStatus::Confirming;
|
status.status = TransactionStatus::Confirming;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
status.status = TransactionStatus::Confirmed;
|
status.status = TransactionStatus::Confirmed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct TransactionStatus {
|
||||||
Confirmed, /**< Have 6 or more confirmations (normal tx) or fully mature (mined tx) **/
|
Confirmed, /**< Have 6 or more confirmations (normal tx) or fully mature (mined tx) **/
|
||||||
/// Normal (sent/received) transactions
|
/// Normal (sent/received) transactions
|
||||||
Unconfirmed, /**< Not yet mined into a block **/
|
Unconfirmed, /**< Not yet mined into a block **/
|
||||||
|
AssumedConfirmed, /**< Confirmed, but background validation hasn't finished */
|
||||||
Confirming, /**< Confirmed, but waiting for the recommended number of confirmations **/
|
Confirming, /**< Confirmed, but waiting for the recommended number of confirmations **/
|
||||||
Conflicted, /**< Conflicts with other transaction or mempool **/
|
Conflicted, /**< Conflicts with other transaction or mempool **/
|
||||||
Abandoned, /**< Abandoned from the wallet **/
|
Abandoned, /**< Abandoned from the wallet **/
|
||||||
|
|
|
@ -320,6 +320,9 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
|
||||||
case TransactionStatus::Abandoned:
|
case TransactionStatus::Abandoned:
|
||||||
status = tr("Abandoned");
|
status = tr("Abandoned");
|
||||||
break;
|
break;
|
||||||
|
case TransactionStatus::AssumedConfirmed:
|
||||||
|
status = tr("%1 confirmations, pending verification of historical blocks").arg(wtx->status.depth);
|
||||||
|
break;
|
||||||
case TransactionStatus::Confirming:
|
case TransactionStatus::Confirming:
|
||||||
status = tr("Confirming (%1 of %2 recommended confirmations)").arg(wtx->status.depth).arg(TransactionRecord::RecommendedNumConfirmations);
|
status = tr("Confirming (%1 of %2 recommended confirmations)").arg(wtx->status.depth).arg(TransactionRecord::RecommendedNumConfirmations);
|
||||||
break;
|
break;
|
||||||
|
@ -465,6 +468,8 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
|
||||||
return QIcon(":/icons/transaction_0");
|
return QIcon(":/icons/transaction_0");
|
||||||
case TransactionStatus::Abandoned:
|
case TransactionStatus::Abandoned:
|
||||||
return QIcon(":/icons/transaction_abandoned");
|
return QIcon(":/icons/transaction_abandoned");
|
||||||
|
case TransactionStatus::AssumedConfirmed:
|
||||||
|
return QIcon(":/icons/transaction_1");
|
||||||
case TransactionStatus::Confirming:
|
case TransactionStatus::Confirming:
|
||||||
switch(wtx->status.depth)
|
switch(wtx->status.depth)
|
||||||
{
|
{
|
||||||
|
@ -639,7 +644,14 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
||||||
return details;
|
return details;
|
||||||
}
|
}
|
||||||
case ConfirmedRole:
|
case ConfirmedRole:
|
||||||
return rec->status.status == TransactionStatus::Status::Confirming || rec->status.status == TransactionStatus::Status::Confirmed;
|
switch (rec->status.status) {
|
||||||
|
case TransactionStatus::Status::AssumedConfirmed:
|
||||||
|
case TransactionStatus::Status::Confirming:
|
||||||
|
case TransactionStatus::Status::Confirmed:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
case FormattedAmountRole:
|
case FormattedAmountRole:
|
||||||
// Used for copy/export, so don't include separators
|
// Used for copy/export, so don't include separators
|
||||||
return formatTxAmount(rec, false, BitcoinUnits::SeparatorStyle::NEVER);
|
return formatTxAmount(rec, false, BitcoinUnits::SeparatorStyle::NEVER);
|
||||||
|
|
Loading…
Add table
Reference in a new issue