Skip to content

Commit 4732fa1

Browse files
author
MarcoFalke
committed
Merge #12818: [qt] TransactionView: highlight replacement tx after fee bump
d795c61 [qt] TransactionView: highlight replacement tx after fee bump (Sjors Provoost) Pull request description: Consistent with #12421 which highlights the transaction after send. <img width="747" alt="1" src="https://user-images.githubusercontent.com/10217/38036280-a7358ea4-32a6-11e8-8f92-417e9e1e3e8b.png"> <img width="685" alt="2" src="https://user-images.githubusercontent.com/10217/38036289-aac87040-32a6-11e8-9f94-81745ff6c592.png"> ~I'm not too proud of the `QTimer::singleShot(10` bit; any suggestions on how to properly wait for the transactions table to become aware of the new transaction?~ Although I could have called `focusTransaction()` directly from `TransactionView::bumpFee()` I'm using the same signal as the send screen. This should make it easier to move fee bump / transaction replacement functionality around later. Tree-SHA512: 242055b7c3d32c7b2cf871f5ceda2581221902fd53fa29e0b092713fc16d3191adbe8cbb28417d522dda9febec8cc05e07afe3489cd7caaecd33460c1dde6fbc
2 parents 2a58340 + d795c61 commit 4732fa1

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

src/qt/transactionview.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <ui_interface.h>
2121

22+
#include <QApplication>
2223
#include <QComboBox>
2324
#include <QDateTimeEdit>
2425
#include <QDesktopServices>
@@ -198,6 +199,11 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
198199
connect(copyTxPlainText, SIGNAL(triggered()), this, SLOT(copyTxPlainText()));
199200
connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
200201
connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
202+
203+
// Highlight transaction after fee bump
204+
connect(this, &TransactionView::bumpedFee, [this](const uint256& txid) {
205+
focusTransaction(txid);
206+
});
201207
}
202208

203209
void TransactionView::setModel(WalletModel *_model)
@@ -428,9 +434,14 @@ void TransactionView::bumpFee()
428434
hash.SetHex(hashQStr.toStdString());
429435

430436
// Bump tx fee over the walletModel
431-
if (model->bumpFee(hash)) {
437+
uint256 newHash;
438+
if (model->bumpFee(hash, newHash)) {
432439
// Update the table
440+
transactionView->selectionModel()->clearSelection();
433441
model->getTransactionTableModel()->updateTransaction(hashQStr, CT_UPDATED, true);
442+
443+
qApp->processEvents();
444+
Q_EMIT bumpedFee(newHash);
434445
}
435446
}
436447

src/qt/transactionview.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ private Q_SLOTS:
110110
/** Fired when a message should be reported to the user */
111111
void message(const QString &title, const QString &message, unsigned int style);
112112

113+
void bumpedFee(const uint256& txid);
114+
113115
public Q_SLOTS:
114116
void chooseDate(int idx);
115117
void chooseType(int idx);

src/qt/walletmodel.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ bool WalletModel::saveReceiveRequest(const std::string &sAddress, const int64_t
492492
return m_wallet->addDestData(dest, key, sRequest);
493493
}
494494

495-
bool WalletModel::bumpFee(uint256 hash)
495+
bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
496496
{
497497
CCoinControl coin_control;
498498
coin_control.m_signal_bip125_rbf = true;
@@ -544,8 +544,7 @@ bool WalletModel::bumpFee(uint256 hash)
544544
return false;
545545
}
546546
// commit the bumped transaction
547-
uint256 txid;
548-
if(!m_wallet->commitBumpTransaction(hash, std::move(mtx), errors, txid)) {
547+
if(!m_wallet->commitBumpTransaction(hash, std::move(mtx), errors, new_hash)) {
549548
QMessageBox::critical(0, tr("Fee bump error"), tr("Could not commit transaction") + "<br />(" +
550549
QString::fromStdString(errors[0])+")");
551550
return false;

src/qt/walletmodel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class WalletModel : public QObject
194194
void loadReceiveRequests(std::vector<std::string>& vReceiveRequests);
195195
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest);
196196

197-
bool bumpFee(uint256 hash);
197+
bool bumpFee(uint256 hash, uint256& new_hash);
198198

199199
static bool isWalletEnabled();
200200
bool privateKeysDisabled() const;

0 commit comments

Comments
 (0)