Skip to content

psbt: misc fixes and add remaining BIP 174 and BIP 370 test vectors #839

Draft
Sjors wants to merge 13 commits into
bitcoin-core:masterfrom
Sjors:2026/07/psbt
Draft

psbt: misc fixes and add remaining BIP 174 and BIP 370 test vectors #839
Sjors wants to merge 13 commits into
bitcoin-core:masterfrom
Sjors:2026/07/psbt

Conversation

@Sjors

@Sjors Sjors commented Jul 10, 2026

Copy link
Copy Markdown
Member

Based on:

Each fix / hardening commit introduces the test vectors that cover it.

Mostly straight-forward, but psbt: parse the global unsigned tx without witness data is worth a closer look. IIUC it catches up with bitcoin/bips#1099.

Sjors and others added 13 commits July 3, 2026 21:30
The rolling nightly toolchain has drifted past what trezor-firmware
core/v2.9.6 supports: recent nightlies reject its
reexport_test_harness_main attribute with error E0658. Pin the nightly
to 2025-04-15, matching the firmware's own shell.nix.

Co-authored-by: Claude (Fable 5) <noreply@anthropic.com>
Also drops Python 3.6 dataclasses leftover.
The Ledger bitcoin app repos have moved:
- new: from LedgerHQ/app-bitcoin-new to LedgerHQ/app-bitcoin
- legacy: from LedgerHQ/app-bitcoin to LedgerHQ/app-bitcoin-legacy
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.
get_unsigned_tx() assigned the computed locktime to a stray
attribute on the PSBT, so the constructed transaction kept
locktime 0.
get_unsigned_tx() asserted that every input has a sequence number,
crashing on the minimal BIP 370 test vector.
The witness-detecting deserializer accepted witness-serialized
unsigned transactions and misread valid ones with no inputs.
A provided unsigned tx with no inputs and outputs is
indistinguishable from the empty placeholder.
The global PSBTv2 fields were already rejected.
compute_lock_time() was previously untested.
The test data now covers every vector from both BIPs; these all
already pass.
@Sjors Sjors mentioned this pull request Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants