What changed, and why it matters
This commit is a minor documentation/comment cleanup in the code that checks whether a Bitcoin transaction's claimed previous transaction data actually matches the real one. The code logic itself does not appear to change; only the explanatory comments are rewritten to be clearer about why a mismatch is treated as an attack. Because no actual code behavior changes, this is unlikely to be a security fix on its own, but it touches code that is security-relevant (preventing a malicious coordinator from lying about how much bitcoin is being spent).
No immediate action is required for this commit because it changes only comments. However, reviewers should confirm that the surrounding _verify_input_amounts() logic already correctly handles both witness_utxo and non_witness_utxo cases, and that the PSBTInputAmountVerificationError is propagated to the user. If this commit is part of a larger pull request, review the full PR for any related functional changes.
Security signals we found
Code is part of PSBT input amount verification, a security-critical function
Existing logic treats non_witness_utxo mismatch as an attack
No executable code change; comment-only refactor
Commit title and co-author indicate this is a review-suggestion follow-up, not a disclosed security fix
Evidence from the diff
The change is in src/seedsigner/models/psbt_parser.py inside _verify_input_amounts(). The diff only rewrites comments around inp.verify() and the exception handling. No executable statements are added, removed, or altered. The existing logic raises PSBTInputAmountVerificationError if inp.verify() fails, which happens when the non_witness_utxo hash does not match the input’s txid. This is part of SeedSigner’s defense against PSBT input amount spoofing by an untrusted coordinator. The commit appears to be applying a review suggestion from @kdmukai to improve comment accuracy.
Changed components
src/seedsigner/models/psbt_parser.pyInspect captured patch +5 / −4
### src/seedsigner/models/psbt_parser.py
@@ -396,12 +396,13 @@ def _verify_input_amounts(self):
raise PSBTMissingInputUtxoError(f"Input {i}: outpoint index {inp.vout} is out of range of its non_witness_utxo")
try:
+ # verify() checks that the provided non_witness_utxo matches the txid this
+ # input spends.
inp.verify()
except PSBTError as e:
- # verify() hashes the non_witness_utxo and raises if that hash doesn't match the
- # txid this input references, so it isn't the transaction that created this coin.
- # The amount the coordinator declared for this input can't be trusted, so we
- # treat this as an attack.
+ # The provided non_witness_utxo is not the transaction that created this coin.
+ # As a result, we cannot trust the psbt's claims about the amount this input spends.
+ # We treat this as an attack.
raise PSBTInputAmountVerificationError(f"Input {i}: {e}")
# With both non_witness_utxo and witness_utxo present, compare them. verify() onlyWhy this scored 57/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.