wallet: make_unsigned_transaction: nicer error msg for bad outputs
What changed, and why it matters
This commit adds a clearer error message inside Electrum's wallet code when a developer passes the wrong kind of transaction output object to a function that builds unsigned transactions. It is a defensive programming/debugging improvement, not a security fix. There is no indication it addresses a vulnerability or changes user-facing behavior beyond producing a more informative error.
No security action required. Treat as a normal code-quality/debugging improvement.
Security signals we found
No security-relevant signal present
Change is a developer-facing assertion for improved error diagnostics
Evidence from the diff
In electrum/wallet.py, make_unsigned_transaction now asserts that every item in the outputs list is a PartialTxOutput, and if not it raises an AssertionError showing the actual types. Previously, passing a list of TxOutput objects would fail later with a confusing traceback. The change is purely an assertion for better diagnostics; it does not alter transaction construction logic, validation, or signature handling.
Changed components
electrum/wallet.pyAbstract_Wallet.make_unsigned_transactionInspect captured patch +1 / −0
diff --git a/electrum/wallet.py b/electrum/wallet.py
index 93b8985..90a0040 100644
--- a/electrum/wallet.py
+++ b/electrum/wallet.py
@@ -1977,6 +1977,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
raise Exception("Some inputs already contain signatures!")
if inputs is None:
inputs = []
+ assert all(isinstance(o, PartialTxOutput) for o in outputs), [type(o) for o in outputs]
# make sure inputs and coins do not overlap
if inputs:
input_set = set(txin.prevout for txin in inputs)
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.