wallet: Clarify IsEquivalentTo is actually checking malleation
What changed, and why it matters
This commit is a simple rename and documentation update. A wallet function called IsEquivalentTo is renamed to IsMalleation, and its comment is expanded to explain exactly what it checks. No behavior changes, no bug fixes, and no security implications are present in the diff.
No action needed. This is a code-clarity refactor with no security or functional change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch renames CWalletTx::IsEquivalentTo to CWalletTx::IsMalleation across declaration, definition, and one call site in GetMalleatedVariants. The implementation remains identical: it still calls GetTx()->Equals(…, {.include_script_sig = false, .include_witness_data = false}). The header comment is updated to describe that the method detects malleation by comparing version, locktime, input order/outpoints/sequences, and outputs while ignoring scriptSigs and scriptWitnesses. This is a non-functional refactor.
Changed components
src/wallet/transaction.cppsrc/wallet/transaction.hsrc/wallet/wallet.cppInspect captured patch +5 / −4
### src/wallet/transaction.cpp
@@ -11,7 +11,7 @@
using interfaces::FoundBlock;
namespace wallet {
-bool CWalletTx::IsEquivalentTo(const CWalletTx& _tx) const
+bool CWalletTx::IsMalleation(const CWalletTx& _tx) const
{
return GetTx()->Equals(*_tx.GetTx(), {.include_script_sig = false, .include_witness_data = false});
}
### src/wallet/transaction.h
@@ -366,8 +366,9 @@ class CWalletTx
m_cached_from_me = std::nullopt;
}
- /** True if only scriptSigs are different */
- bool IsEquivalentTo(const CWalletTx& tx) const;
+ /** True if tx is a malleation of this, i.e. it has the exact same version, locktime,
+ * input order, input outpoints, input sequences, and outputs. Input scriptSigs and input scriptWitnesses may differ. */
+ bool IsMalleation(const CWalletTx& tx) const;
bool InMempool() const;
### src/wallet/wallet.cpp
@@ -753,7 +753,7 @@ std::set<CWalletTx*, WalletTxOrderComparator> CWallet::GetMalleatedVariants(cons
if (!Assume(entry != mapWallet.end())) continue; // sanity-check: mapTxSpends has txs that are in mapWallet
const bool is_self = &entry->second == &wtx;
found_self |= is_self;
- if (is_self || wtx.IsEquivalentTo(entry->second)) {
+ if (is_self || wtx.IsMalleation(entry->second)) {
Assume(txs.insert(&entry->second).second);
}
}Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.