Skip to content

Read a PSBT's signatures faithfully - #5

Merged
kwsantiago merged 1 commit into
masterfrom
keep-tap-script-signatures
Sep 6, 2026
Merged

Read a PSBT's signatures faithfully#5
kwsantiago merged 1 commit into
masterfrom
keep-tap-script-signatures

Conversation

@kwsantiago

@kwsantiago kwsantiago commented Sep 5, 2026

Copy link
Copy Markdown

A PSBT that carries taproot script path signatures and nothing else looked exactly like an unsigned one, because PSBT_IN_TAP_SCRIPT_SIG (0x14) was discarded at parse, and those signatures were also lost on the way back out. They are kept as hex, so a combiner hands back what it was given.

getVerifiedSignatures checks a partial signature against the key that names it, matched by curve point, rather than against every key the caller holds: an 11 of 15 input costs 11 checks instead of 165. The guarantee is unchanged, because the named key still has to be one the caller vouches for and the signature still has to verify under it. getVerifiedPartialSignatures keeps those pairs, since a signature does not carry the key that made it and compares by hash type and by r and s alone.

A public key in a PSBT is not validated when it is parsed, so a key that is not a point on the curve is now refused rather than thrown past the caller: it left verifySignatures as an IllegalArgumentException from a method declaring PSBTSignatureException, which the open path does not catch.

Needed by privkeyio/shrike#28.

@kwsantiago kwsantiago changed the title Keep a taproot script path signature instead of dropping it at the door Read a PSBT's signatures faithfully, and keep the ones that opt in Sep 5, 2026
@kwsantiago kwsantiago changed the title Read a PSBT's signatures faithfully, and keep the ones that opt in Read a PSBT's signatures faithfully Sep 6, 2026
Taproot script path signatures were discarded at parse, so an input carrying only those looked exactly like an unsigned one, and they were lost on the way back out. They are kept as hex, so a combiner hands back what it was given.

A partial signature is verified against the key that names it, matched by curve point, rather than against every key the caller holds: an 11 of 15 input costs 11 checks instead of 165. The named key still has to be one the caller vouches for and the signature still has to verify under it. getVerifiedPartialSignatures keeps those pairs, since a signature does not carry the key that made it and compares by hash type and by r and s alone.

A public key in a PSBT is not validated at parse, so one that is not a point on the curve is refused rather than thrown past the caller.
@kwsantiago
kwsantiago force-pushed the keep-tap-script-signatures branch from eb526bc to efa39ed Compare September 6, 2026 00:50
@kwsantiago
kwsantiago merged commit 065a256 into master Sep 6, 2026
@kwsantiago
kwsantiago deleted the keep-tap-script-signatures branch September 6, 2026 01:17
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.

1 participant