aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-07-18 22:24:38 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-07-24 09:15:34 +0200
commitfa103db2bb736bce4440f0bde564e6671e36311d (patch)
tree627a89bedc424b668b97aa1aa90ef30e915de305 /src/qt
parentfafe4b80512a5a82712a3ee81b68cfeb21271dee (diff)
scripted-diff: Rename SetHex to SetHexDeprecated
SetHex is fragile, because it accepts any non-hex input or any length of input, without error feedback. This can lead to issues when the input is truncated or otherwise corrupted. Document the problem by renaming the method. In the future, the fragile method should be removed from the public interface. -BEGIN VERIFY SCRIPT- sed -i 's/SetHex/SetHexDeprecated/g' $( git grep -l SetHex ./src ) -END VERIFY SCRIPT-
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/transactiontablemodel.cpp2
-rw-r--r--src/qt/transactionview.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index d4267fcf61..9214e7723d 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -277,7 +277,7 @@ void TransactionTableModel::updateAmountColumnTitle()
void TransactionTableModel::updateTransaction(const QString &hash, int status, bool showTransaction)
{
uint256 updated;
- updated.SetHex(hash.toStdString());
+ updated.SetHexDeprecated(hash.toStdString());
priv->updateWallet(walletModel->wallet(), updated, status, showTransaction);
}
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index 7e24dbd3ec..2aaa65c6f7 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -396,7 +396,7 @@ void TransactionView::contextualMenu(const QPoint &point)
// check if transaction can be abandoned, disable context menu action in case it doesn't
uint256 hash;
- hash.SetHex(selection.at(0).data(TransactionTableModel::TxHashRole).toString().toStdString());
+ hash.SetHexDeprecated(selection.at(0).data(TransactionTableModel::TxHashRole).toString().toStdString());
abandonAction->setEnabled(model->wallet().transactionCanBeAbandoned(hash));
bumpFeeAction->setEnabled(model->wallet().transactionCanBeBumped(hash));
copyAddressAction->setEnabled(GUIUtil::hasEntryData(transactionView, 0, TransactionTableModel::AddressRole));
@@ -416,7 +416,7 @@ void TransactionView::abandonTx()
// get the hash from the TxHashRole (QVariant / QString)
uint256 hash;
QString hashQStr = selection.at(0).data(TransactionTableModel::TxHashRole).toString();
- hash.SetHex(hashQStr.toStdString());
+ hash.SetHexDeprecated(hashQStr.toStdString());
// Abandon the wallet transaction over the walletModel
model->wallet().abandonTransaction(hash);
@@ -431,7 +431,7 @@ void TransactionView::bumpFee([[maybe_unused]] bool checked)
// get the hash from the TxHashRole (QVariant / QString)
uint256 hash;
QString hashQStr = selection.at(0).data(TransactionTableModel::TxHashRole).toString();
- hash.SetHex(hashQStr.toStdString());
+ hash.SetHexDeprecated(hashQStr.toStdString());
// Bump tx fee over the walletModel
uint256 newHash;