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

primitives: fix witness commitment check (BIP141)

Public commit record

What the developer wrote

Authored by Boris Nagaev

68/100 · Adequate
primitives: fix witness commitment check (BIP141)

If a block has a witness commitment, it must also contain exactly one
32-byte witness reserved value EVEN IF no transactions use SegWit.

The commit enforces this check by moving the "there are no transactions
using SegWit" check after the coinbase witness commitment and witness
reserved value checks. Now the check is in line with Bitcoin Core and btcd.

Assisted-by: OpenAI GPT-5
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug in how the rust-bitcoin library validates witness commitments in Bitcoin blocks. Under BIP141 rules, if a block contains a witness commitment, the coinbase transaction must also contain exactly one 32-byte witness reserved value, even when no other transactions use SegWit. The old code skipped this requirement when no SegWit transactions were present, which could let an invalid block appear valid. The fix moves the 'no SegWit transactions' shortcut after the commitment/reserved-value checks, matching Bitcoin Core and btcd behavior.

Recommended action

Review any downstream code that relies on this validation for consensus-critical decisions, and upgrade to a version containing this fix. If the library is used in a full-node or block-relay context, treat this as a priority patch. No immediate user action is required for wallet-only usage.

Security signals we found

01

Consensus-adjacent validation bug in block witness commitment check

02

Bypass of required coinbase witness reserved value when no SegWit transactions present

03

Behavior now aligned with Bitcoin Core and btcd

04

Potential for accepting invalid blocks or rejecting valid ones depending on network usage

Risk score

Why this scored 59/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/15
Confidence 7/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.