This repository was archived by the owner on Oct 22, 2026. It is now read-only.
Repository navigation
plan: fix missing signatures for fresh Taproot script spends - #1062
Merged
Merged
Conversation
When applying a script-path plan to a fresh PSBT input, update_psbt_input recorded the signing keys but omitted the selected script's leaf hash. rust-bitcoin's Psbt::sign uses these hashes to choose scripts to sign, so it produced no script-path signature. Initialize new key-origin entries with the selected leaf hash. New key-path entries remain empty; existing entries continue to accumulate hashes without duplicates. Test leaf-hash metadata, repeated updates, and signing a freshly prepared script spend. Assisted-by: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
Plan::update_psbt_inputprepares a fresh PSBT input for a Taproot script spend, it records the signing keys but gives theirtap_key_originsentries an empty leaf-hash list. That list tells the signer which scripts to sign. With no hashes listed, rust-bitcoin'sPsbt::signproduces no script-path signature, even when it has the required private key.Initialize new entries with the selected script's leaf hash. New key-path entries get an empty list, since those spends use no script.
The tests check leaf hashes for key spends and
pkh/multi_aleaves, accumulation without duplicates across repeated updates, and signing a freshly prepared script spend.This pre-existing bug was found while working on #954.
🤖 AI disclosure: The patch and tests were generated with Claude Opus 5.5. Codex reviewed the change and drafted this description.