Skip to content

fix: initialize reused PSBT v0 maps - #551

Closed
kkdao wants to merge 1 commit into
ElementsProject:masterfrom
kkdao:fix/psbt-v0-map-verifiers
Closed

kkdao wants to merge 1 commit into
ElementsProject:masterfrom
kkdao:fix/psbt-v0-map-verifiers

Conversation

@kkdao

@kkdao kkdao commented Sep 26, 2026

Copy link
Copy Markdown

wally_psbt_from_tx(tx, WALLY_PSBT_VERSION_0, ...) preallocates input and output slots. psbt_set_global_tx() reuses those slots without setting their map validators, so adding valid BIP32 key-origin data returns WALLY_EINVAL.

Set validators when reused slots become active, preserving existing map contents and leaving unused reserved slots untouched. Add regression coverage for from_tx and init_alloc with exact and spare capacity.

The new test failed in all three creation cases before the fix. Afterward, 15 Python PSBT/map tests and the native PSBT and PSBT limits tests passed on a Bitcoin-only macOS build. The full upstream and Elements suites were not run locally.

@jgriffiths

Copy link
Copy Markdown
Contributor

I've gone with a simpler approach and test but left the change credited to you. Will merge once our internal CI is clear - thanks!

@jgriffiths

Copy link
Copy Markdown
Contributor

Included in #549, closing. Thanks again!

@jgriffiths jgriffiths closed this Sep 29, 2026
@kkdao
kkdao deleted the fix/psbt-v0-map-verifiers branch September 29, 2026 16:36
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