Browse Source

Merge #10449: Overhaul Qt fee bumper

6d7104c99 [Qt] make sure transaction table entry gets updated after bump (Jonas Schnelli)
32325a3f5 [Qt] hide bump context menu action if tx already has been bumped (Jonas Schnelli)

Tree-SHA512: d3e5991145879b7f6b212d9d9c6f423609dc8e6fa7f6feb7df931691f1dec2acb6ab162c2fb7e758d3ca3f3fb14363df2f50f0e83e83068da5cc7e6de35e69d2
0.15
Jonas Schnelli 8 years ago
parent
commit
64beb13179
No known key found for this signature in database
GPG Key ID: 1EB776BB03C7922D
  1. 4
      src/qt/transactionrecord.cpp
  2. 2
      src/qt/transactionrecord.h
  3. 4
      src/qt/transactiontablemodel.cpp
  4. 2
      src/qt/transactionview.cpp
  5. 4
      src/qt/walletmodel.cpp
  6. 2
      src/qt/walletmodel.h

4
src/qt/transactionrecord.cpp

@ -246,13 +246,13 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
status.status = TransactionStatus::Confirmed; status.status = TransactionStatus::Confirmed;
} }
} }
status.needsUpdate = false;
} }
bool TransactionRecord::statusUpdateNeeded() bool TransactionRecord::statusUpdateNeeded()
{ {
AssertLockHeld(cs_main); AssertLockHeld(cs_main);
return status.cur_num_blocks != chainActive.Height(); return status.cur_num_blocks != chainActive.Height() || status.needsUpdate;
} }
QString TransactionRecord::getTxID() const QString TransactionRecord::getTxID() const

2
src/qt/transactionrecord.h

@ -61,6 +61,8 @@ public:
/** Current number of blocks (to know whether cached status is still valid) */ /** Current number of blocks (to know whether cached status is still valid) */
int cur_num_blocks; int cur_num_blocks;
bool needsUpdate;
}; };
/** UI model for a transaction. A core transaction can be represented by multiple UI transactions if it has /** UI model for a transaction. A core transaction can be represented by multiple UI transactions if it has

4
src/qt/transactiontablemodel.cpp

@ -168,6 +168,10 @@ public:
case CT_UPDATED: case CT_UPDATED:
// Miscellaneous updates -- nothing to do, status update will take care of this, and is only computed for // Miscellaneous updates -- nothing to do, status update will take care of this, and is only computed for
// visible transactions. // visible transactions.
for (int i = lowerIndex; i < upperIndex; i++) {
TransactionRecord *rec = &cachedWallet[i];
rec->status.needsUpdate = true;
}
break; break;
} }
} }

2
src/qt/transactionview.cpp

@ -379,7 +379,7 @@ void TransactionView::contextualMenu(const QPoint &point)
uint256 hash; uint256 hash;
hash.SetHex(selection.at(0).data(TransactionTableModel::TxHashRole).toString().toStdString()); hash.SetHex(selection.at(0).data(TransactionTableModel::TxHashRole).toString().toStdString());
abandonAction->setEnabled(model->transactionCanBeAbandoned(hash)); abandonAction->setEnabled(model->transactionCanBeAbandoned(hash));
bumpFeeAction->setEnabled(model->transactionSignalsRBF(hash)); bumpFeeAction->setEnabled(model->transactionCanBeBumped(hash));
if(index.isValid()) if(index.isValid())
{ {

4
src/qt/walletmodel.cpp

@ -656,11 +656,11 @@ bool WalletModel::abandonTransaction(uint256 hash) const
return wallet->AbandonTransaction(hash); return wallet->AbandonTransaction(hash);
} }
bool WalletModel::transactionSignalsRBF(uint256 hash) const bool WalletModel::transactionCanBeBumped(uint256 hash) const
{ {
LOCK2(cs_main, wallet->cs_wallet); LOCK2(cs_main, wallet->cs_wallet);
const CWalletTx *wtx = wallet->GetWalletTx(hash); const CWalletTx *wtx = wallet->GetWalletTx(hash);
return wtx && SignalsOptInRBF(*wtx); return wtx && SignalsOptInRBF(*wtx) && !wtx->mapValue.count("replaced_by_txid");
} }
bool WalletModel::bumpFee(uint256 hash) bool WalletModel::bumpFee(uint256 hash)

2
src/qt/walletmodel.h

@ -207,7 +207,7 @@ public:
bool transactionCanBeAbandoned(uint256 hash) const; bool transactionCanBeAbandoned(uint256 hash) const;
bool abandonTransaction(uint256 hash) const; bool abandonTransaction(uint256 hash) const;
bool transactionSignalsRBF(uint256 hash) const; bool transactionCanBeBumped(uint256 hash) const;
bool bumpFee(uint256 hash); bool bumpFee(uint256 hash);
static bool isWalletEnabled(); static bool isWalletEnabled();

Loading…
Cancel
Save