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

primitives: reject transactions with invalid coinbase scriptSig length

Public commit record

What the developer wrote

Authored by jrakibi

65/100 · Adequate
primitives: reject transactions with invalid coinbase scriptSig length

Coinbase input scriptSig must be between 2 and 100 bytes in length.
Add this validation rule to transaction decoder
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body
The short version

What changed, and why it matters

This commit adds a missing validation rule to the library's Bitcoin transaction decoder: a coinbase transaction (the special first transaction in a block that creates new coins) must have an input script between 2 and 100 bytes long. Before this change, the library would accept shorter or longer coinbase scripts, which violates Bitcoin consensus rules and could let malformed transactions slip through. The fix rejects them with clear errors and includes tests for the boundary cases.

Recommended action

Review whether any other transaction decoders or deserialization paths in the crate bypass this decoder and could still accept invalid coinbase lengths. Re-enable or update the ignored block_decode test promptly. Consider whether this rule should also be enforced at construction time for programmatically built coinbase transactions, not only during decoding.

Security signals we found

01

Consensus-rule validation gap closed in transaction decoder

02

New explicit error variants for malformed coinbase scriptSig lengths

03

Test vectors borrowed from Bitcoin Core tx_invalid.json

04

Existing test marked ignored due to previously accepted invalid coinbase

Risk score

Why this scored 52/100

Our methodology →
Potential impact 12/30
Exploitability 10/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.