Skip to content

13.x: plan: add Plan::tap_sighash_default accessor#952

Open
evanlinjin wants to merge 2 commits into
rust-bitcoin:release-13.xfrom
evanlinjin:13.x-plan-tap-sighash-default
Open

13.x: plan: add Plan::tap_sighash_default accessor#952
evanlinjin wants to merge 2 commits into
rust-bitcoin:release-13.xfrom
evanlinjin:13.x-plan-tap-sighash-default

Conversation

@evanlinjin
Copy link
Copy Markdown
Contributor

@evanlinjin evanlinjin commented May 17, 2026

Summary

13.x backport of #951.

Adds a public accessor on Plan that exposes the existing per-Schnorr-placeholder size assumption — recorded when the plan was built from TaprootCanSign::sighash_default — as a single Option<bool>.

impl Plan {
    /// Returns whether the witness was sized assuming `SIGHASH_DEFAULT` (the
    /// 64-byte Taproot signature encoding).
    pub fn tap_sighash_default(&self) -> Option<bool>;
}

See #951 for full rationale and the test.

Test plan

🤖 Generated with Claude Code

@evanlinjin evanlinjin force-pushed the 13.x-plan-tap-sighash-default branch from 8f4a22b to 4da734a Compare May 17, 2026 08:15
@evanlinjin evanlinjin marked this pull request as ready for review May 17, 2026 08:23
@evanlinjin evanlinjin force-pushed the 13.x-plan-tap-sighash-default branch from 4da734a to 022cb02 Compare May 17, 2026 08:34
Exposes the existing per-Schnorr-placeholder size assumption — recorded
when the plan was built from `TaprootCanSign::sighash_default` — as a
single `Option<bool>` on the Plan.

Returns `Some(true)` when every Schnorr placeholder is sized for a
64-byte signature (SIGHASH_DEFAULT), `Some(false)` when every one is
sized for 65 bytes (any non-Default Taproot sighash flag), and `None`
for non-Taproot plans or mixed plans that cannot be expressed by a
single uniform sighash policy per BIP-174.

Callers constructing a PSBT can use this to populate
`PSBT_IN_SIGHASH_TYPE` consistently with the witness-size assumption
baked into `Plan::satisfaction_weight`.
@evanlinjin evanlinjin force-pushed the 13.x-plan-tap-sighash-default branch from 022cb02 to 304585a Compare May 17, 2026 08:50
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