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-
This commit is contained in:
6 files changed
+19
-19
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user