AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 60 Bitcoin

fix: preserve SIGHASH.DEFAULT (0) for taproot signatures (#399)

Public commit record

What the developer wrote

Authored by Schnuartz AI

93/100 · Strong
fix: preserve SIGHASH.DEFAULT (0) for taproot signatures (#399)

Co-authored-by: Schnuartz <schnuartz@gmail.com>
Co-authored-by: maggo83 <maggo83@proton.me>
Co-authored-by: schnuartz-ai <258758258+schnuartz-ai@users.noreply.github.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a bug in Specter DIY where taproot Bitcoin signatures could be produced with the wrong signature type. Because the value for the default taproot sighash is 0, the old code treated it as 'no value set' and fell back to the normal default (SIGHASH_ALL), producing a 65-byte signature ending in 0x01 instead of the correct 64-byte bare Schnorr signature required by BIP341. The fix makes the wallet choose SIGHASH.DEFAULT for taproot inputs and keeps SIGHASH.ALL for non-taproot inputs. It also prevents an invalid combination (DEFAULT | ANYONECANPAY) from being accepted and adds tests.

Recommended action

Review and merge the patch, then run the new native sighash tests. Ensure downstream signing flows and any external documentation about taproot signature format are updated to reflect that bare 64-byte Schnorr signatures are now produced for taproot key-path inputs with default sighash.

Security signals we found

01

Wrong signature encoding produced for taproot key-path spends when no explicit or with explicit SIGHASH.DEFAULT

02

Falsy-zero fallback changed effective sighash from DEFAULT to ALL for taproot inputs

03

Invalid sighash value 0x80 (DEFAULT | ANYONECANPAY) was previously accepted due to loop over all SIGHASH_NAMES keys

04

User confirmation logic for custom sighashes compared against a single global default, missing taproot-specific non-default sighashes

05

Comprehensive regression tests added covering implicit DEFAULT, explicit 0, explicit ALL, mixed inputs, and Liquid rejection of bare 0

Risk score

Why this scored 60/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.