AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 61 Bitcoin

psbt: don't overwrite PSBTv2 tx version and fallback locktime

Public commit record

What the developer wrote

Authored by Sjors Provoost

88/100 · Strong
psbt: don't overwrite PSBTv2 tx version and fallback locktime

self.tx is never None, for PSBTv2 it's an empty placeholder. Its
defaults would overwrite the deserialized tx version and fallback
locktime, invalidating any existing signature. Check the PSBT
version instead, here and in get_unsigned_tx().

Without this fix all BIP 370 valid test vectors, now added, fail
the serialization round-trip.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a bug in how the HWI library handles a newer Bitcoin transaction format called PSBTv2. Previously, when converting or setting up a PSBTv2 object, the code would accidentally overwrite the transaction's version number and locktime with default values. That could silently invalidate digital signatures that were already created for the transaction. The fix checks the PSBT version before touching those fields, and adds official BIP 370 test vectors to prevent the bug from returning.

Recommended action

Review and merge the patch, then run the updated PSBT test suite to confirm all BIP 370 vectors pass serialization round-trip and conversion to v0. Consider auditing any downstream code that relies on get_unsigned_tx() or convert_to_v0() for PSBTv2 inputs to ensure no other paths mutate signed transaction data.

Security signals we found

01

Signature invalidation through mutation of transaction version/locktime

02

Incorrect null-check on PSBTv2 placeholder transaction object

03

PSBTv2 serialization round-trip failure for valid BIP 370 vectors

04

Addition of BIP 370 test vectors and regression test

Risk score

Why this scored 61/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 10/15
Affected reach 10/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.