Skip to content

Commit 64beb13

Browse files
committed
Merge #10449: Overhaul Qt fee bumper
6d7104c [Qt] make sure transaction table entry gets updated after bump (Jonas Schnelli) 32325a3 [Qt] hide bump context menu action if tx already has been bumped (Jonas Schnelli) Tree-SHA512: d3e5991145879b7f6b212d9d9c6f423609dc8e6fa7f6feb7df931691f1dec2acb6ab162c2fb7e758d3ca3f3fb14363df2f50f0e83e83068da5cc7e6de35e69d2
2 parents 27b9931 + 6d7104c commit 64beb13

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

src/qt/transactionrecord.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
246246
status.status = TransactionStatus::Confirmed;
247247
}
248248
}
249-
249+
status.needsUpdate = false;
250250
}
251251

252252
bool TransactionRecord::statusUpdateNeeded()
253253
{
254254
AssertLockHeld(cs_main);
255-
return status.cur_num_blocks != chainActive.Height();
255+
return status.cur_num_blocks != chainActive.Height() || status.needsUpdate;
256256
}
257257

258258
QString TransactionRecord::getTxID() const

src/qt/transactionrecord.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class TransactionStatus
6161

6262
/** Current number of blocks (to know whether cached status is still valid) */
6363
int cur_num_blocks;
64+
65+
bool needsUpdate;
6466
};
6567

6668
/** UI model for a transaction. A core transaction can be represented by multiple UI transactions if it has

src/qt/transactiontablemodel.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ class TransactionTablePriv
168168
case CT_UPDATED:
169169
// Miscellaneous updates -- nothing to do, status update will take care of this, and is only computed for
170170
// visible transactions.
171+
for (int i = lowerIndex; i < upperIndex; i++) {
172+
TransactionRecord *rec = &cachedWallet[i];
173+
rec->status.needsUpdate = true;
174+
}
171175
break;
172176
}
173177
}

src/qt/transactionview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ void TransactionView::contextualMenu(const QPoint &point)
379379
uint256 hash;
380380
hash.SetHex(selection.at(0).data(TransactionTableModel::TxHashRole).toString().toStdString());
381381
abandonAction->setEnabled(model->transactionCanBeAbandoned(hash));
382-
bumpFeeAction->setEnabled(model->transactionSignalsRBF(hash));
382+
bumpFeeAction->setEnabled(model->transactionCanBeBumped(hash));
383383

384384
if(index.isValid())
385385
{

src/qt/walletmodel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,11 @@ bool WalletModel::abandonTransaction(uint256 hash) const
656656
return wallet->AbandonTransaction(hash);
657657
}
658658

659-
bool WalletModel::transactionSignalsRBF(uint256 hash) const
659+
bool WalletModel::transactionCanBeBumped(uint256 hash) const
660660
{
661661
LOCK2(cs_main, wallet->cs_wallet);
662662
const CWalletTx *wtx = wallet->GetWalletTx(hash);
663-
return wtx && SignalsOptInRBF(*wtx);
663+
return wtx && SignalsOptInRBF(*wtx) && !wtx->mapValue.count("replaced_by_txid");
664664
}
665665

666666
bool WalletModel::bumpFee(uint256 hash)

src/qt/walletmodel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class WalletModel : public QObject
207207
bool transactionCanBeAbandoned(uint256 hash) const;
208208
bool abandonTransaction(uint256 hash) const;
209209

210-
bool transactionSignalsRBF(uint256 hash) const;
210+
bool transactionCanBeBumped(uint256 hash) const;
211211
bool bumpFee(uint256 hash);
212212

213213
static bool isWalletEnabled();

0 commit comments

Comments
 (0)