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

python client: fix three PSBTv2 defects in psbt.py

Public commit record

What the developer wrote

Authored by Salvatore Ingala

95/100 · Strong
python client: fix three PSBTv2 defects in psbt.py

- get_unsigned_tx assigned the computed lock time to `self.nLockTime`
instead of `tx.nLockTime`, so the CTransaction it returned always kept
the nLockTime 0.

- cache_unsigned_tx_pieces tested `self.tx is not None`, but __init__
always creates a CTransaction, so the condition is always true -- its
own docstring says "does nothing if the PSBT is already v2". For a
deserialized PSBTv2, whose tx is null, setup_from_tx therefore
overwrote tx_version with 1 and fallback_locktime with 0, discarding
the values just parsed. Test the version instead.

- convert_to_v0 cleared tx_version and fallback_locktime and only then
called get_unsigned_tx(). Build the transaction first to avoid the
values of those fields.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit fixes three bugs in a Python helper that converts modern PSBTv2 transaction data into the older PSBTv0 format used by Ledger hardware wallets. The bugs could silently corrupt the transaction's lock time and version fields during conversion, which might alter when a transaction becomes valid or what transaction format the device signs. The fixes ensure the correct values are copied before they are erased. There is no direct evidence this was exploitable as a security attack, but it could cause unexpected or invalid signatures in wallet software relying on this library.

Recommended action

Update the Python client library to include this commit. Review any signed transactions produced with the buggy version to confirm nLockTime and version fields match intent, especially for time-locked or version-sensitive transactions. Consider adding regression tests for PSBTv2 deserialization and conversion.

Security signals we found

01

Silent data corruption in transaction serialization (nLockTime, tx_version, fallback_locktime)

02

PSBTv2 to PSBTv0 conversion path affected

03

Potential for producing an unsigned transaction that does not match the PSBT's declared fields

04

No explicit security advisory or CVE referenced in commit

Risk score

Why this scored 48/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 10/15
Affected reach 7/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.