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
This commit is contained in:
commit
64beb13179
6 changed files with 12 additions and 6 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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())
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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…
Add table
Reference in a new issue