Keep PSBTNegativeFeeError's docstring to what a caller needs
What changed, and why it matters
This commit only rewrites documentation comments inside the code. It moves some explanatory text from one place to another and shortens a docstring. No program behavior, security checks, or logic were changed.
No action needed; this is a documentation-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is a non-functional refactor of docstrings and inline comments in psbt_parser.py. The PSBTNegativeFeeError class still raises on negative fees exactly as before; only the wording of the explanation was edited. No code paths, conditions, or exception handling were modified.
Changed components
src/seedsigner/models/psbt_parser.pyInspect captured patch +5 / −9
### src/seedsigner/models/psbt_parser.py
@@ -140,13 +140,8 @@ class PSBTNegativeFeeError(PSBTVerificationError):
"""
The outputs spend more than the inputs bring in, so the fee is negative.
- Treated as malformed data rather than an attack. No honest coordinator builds one,
- and a coordinator lying about its input amounts wants the fee it shows us to look
- small, not impossible. Note that the amounts on both sides of that subtraction are
- the coordinator's claims, so a negative result only establishes that the arithmetic
- cannot be trusted, not which side of it is false. Either way nothing is signed here.
- It is raised because the alternative is walking the user through a review that quotes
- a negative fee.
+ This is a malformed psbt rather than a proven deception, so we do not treat it as an
+ attack.
"""
pass
@@ -750,8 +745,9 @@ def _parse_outputs(self, child_key_derivation_cache: dict):
# embit computes the fee as inputs minus outputs and does not look at the sign of
# the result. A negative fee means the outputs claim more than the inputs fund,
- # which no valid transaction can do. Zero is left alone: it is a pointless
- # transaction, but not a malformed one.
+ # which no valid transaction can do. Both totals are the coordinator's own claims,
+ # so this proves the psbt is malformed but not which side is false. Zero is left
+ # alone: it is a pointless transaction, but not a malformed one.
self.fee_amount = self.psbt.fee()
if self.fee_amount < 0:
raise PSBTNegativeFeeError()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.