Skip to content

Commit 7a30ed6

Browse files
committed
[Qt] attribute replaceable (RBF) transactions
1 parent 0b5279f commit 7a30ed6

File tree

10 files changed

+26
-2
lines changed

10 files changed

+26
-2
lines changed

src/Makefile.qt.include

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ RES_ICONS = \
269269
qt/res/icons/tx_mined.png \
270270
qt/res/icons/warning.png \
271271
qt/res/icons/verify.png \
272-
qt/res/icons/transaction_abandoned.png
272+
qt/res/icons/transaction_abandoned.png \
273+
qt/res/icons/transaction_replaceable.png
273274

274275
BITCOIN_QT_CPP = \
275276
qt/bantablemodel.cpp \

src/qt/bitcoin.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<file alias="fontsmaller">res/icons/fontsmaller.png</file>
5151
<file alias="prompticon">res/icons/chevron.png</file>
5252
<file alias="transaction_abandoned">res/icons/transaction_abandoned.png</file>
53+
<file alias="transaction_replaceable">res/icons/transaction_replaceable.png</file>
5354
</qresource>
5455
<qresource prefix="/movies">
5556
<file alias="spinner-000">res/movies/spinner-000.png</file>

src/qt/guiconstants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ static const bool DEFAULT_SPLASHSCREEN = true;
3131
#define COLOR_TX_STATUS_OFFLINE QColor(192, 192, 192)
3232
/* Transaction list -- TX status decoration - danger, tx needs attention */
3333
#define COLOR_TX_STATUS_DANGER QColor(200, 100, 100)
34+
/* Transaction list -- TX status decoration - mempool-replaceable */
35+
#define COLOR_TX_STATUS_REPLACEABLE QColor(230, 130, 20)
3436
/* Transaction list -- TX status decoration - default color */
3537
#define COLOR_BLACK QColor(0, 0, 0)
3638

2.99 KB
Loading

src/qt/transactiondesc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ QString TransactionDesc::FormatTxStatus(const CWalletTx& wtx)
3939
else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
4040
return tr("%1/offline").arg(nDepth);
4141
else if (nDepth == 0)
42-
return tr("0/unconfirmed, %1").arg((wtx.InMempool() ? tr("in memory pool") : tr("not in memory pool"))) + (wtx.isAbandoned() ? ", "+tr("abandoned") : "");
42+
return tr("0/unconfirmed, %1").arg((wtx.InMempool() ? tr("in memory pool") : tr("not in memory pool"))) + (wtx.signalsOptInRBF() ? ", "+tr("signals replaceability (optin RBF)") : "") + (wtx.isAbandoned() ? ", "+tr("abandoned") : "");
4343
else if (nDepth < 6)
4444
return tr("%1/unconfirmed").arg(nDepth);
4545
else

src/qt/transactionrecord.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "base58.h"
88
#include "consensus/consensus.h"
99
#include "main.h"
10+
#include "policy/rbf.h"
1011
#include "timedata.h"
1112
#include "wallet/wallet.h"
1213

@@ -239,6 +240,8 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
239240
else if (status.depth == 0)
240241
{
241242
status.status = TransactionStatus::Unconfirmed;
243+
if (wtx.signalsOptInRBF())
244+
status.status = TransactionStatus::Replaceable;
242245
if (wtx.isAbandoned())
243246
status.status = TransactionStatus::Abandoned;
244247
}

src/qt/transactionrecord.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class TransactionStatus
3131
OpenUntilBlock, /**< Transaction not yet final, waiting for block */
3232
Offline, /**< Not sent to any other nodes **/
3333
Unconfirmed, /**< Not yet mined into a block **/
34+
Replaceable, /**< Replaceable by optin-RBF (bip125) **/
3435
Confirming, /**< Confirmed, but waiting for the recommended number of confirmations **/
3536
Conflicted, /**< Conflicts with other transaction or mempool **/
3637
Abandoned, /**< Abandoned from the wallet **/

src/qt/transactiontablemodel.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
312312
case TransactionStatus::Unconfirmed:
313313
status = tr("Unconfirmed");
314314
break;
315+
case TransactionStatus::Replaceable:
316+
status = tr("Unconfirmed & Replaceable");
317+
break;
315318
case TransactionStatus::Abandoned:
316319
status = tr("Abandoned");
317320
break;
@@ -471,6 +474,8 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
471474
return COLOR_TX_STATUS_OFFLINE;
472475
case TransactionStatus::Unconfirmed:
473476
return QIcon(":/icons/transaction_0");
477+
case TransactionStatus::Replaceable:
478+
return QIcon(":/icons/transaction_replaceable");
474479
case TransactionStatus::Abandoned:
475480
return QIcon(":/icons/transaction_abandoned");
476481
case TransactionStatus::Confirming:
@@ -583,6 +588,10 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
583588
{
584589
return COLOR_TX_STATUS_DANGER;
585590
}
591+
if(rec->status.status == TransactionStatus::Replaceable)
592+
{
593+
return COLOR_TX_STATUS_REPLACEABLE;
594+
}
586595
// Non-confirmed (but not immature) as transactions are grey
587596
if(!rec->status.countsForBalance && rec->status.status != TransactionStatus::Immature)
588597
{

src/wallet/wallet.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "main.h"
1717
#include "net.h"
1818
#include "policy/policy.h"
19+
#include "policy/rbf.h"
1920
#include "primitives/block.h"
2021
#include "primitives/transaction.h"
2122
#include "script/script.h"
@@ -3475,3 +3476,8 @@ bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree, CAmount nAbsurdFee)
34753476
CValidationState state;
34763477
return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL, false, nAbsurdFee);
34773478
}
3479+
3480+
bool CMerkleTx::signalsOptInRBF() const
3481+
{
3482+
return SignalsOptInRBF(*this);
3483+
}

src/wallet/wallet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ class CMerkleTx : public CTransaction
213213
bool hashUnset() const { return (hashBlock.IsNull() || hashBlock == ABANDON_HASH); }
214214
bool isAbandoned() const { return (hashBlock == ABANDON_HASH); }
215215
void setAbandoned() { hashBlock = ABANDON_HASH; }
216+
bool signalsOptInRBF() const;
216217
};
217218

218219
/**

0 commit comments

Comments
 (0)