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

Clear pushnum cache on signature operations in sigop count

Public commit record

What the developer wrote

Authored by Abeeujah

78/100 · Adequate
Clear pushnum cache on signature operations in sigop count

The `pushnum_cache` was not cleared when encountering a non-push
signature opcode like `OP_CHECKSIG`. This allowed stale push numbers
to leak into subsequent multisig operations if they weren't directly
preceded by a small int push.

Fix this by resetting the cache on signature opcodes, aligning the
sigop calculation with Bitcoin Core consensus logic.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a bug in how the library counts 'signature operations' (sigops) in Bitcoin scripts. A small cache that remembers recently pushed numbers was not being cleared after signature-checking opcodes. This could cause a later multi-signature operation to incorrectly reuse a stale number, making the sigop count too low or too high in edge cases. The fix resets the cache whenever a signature opcode is seen, matching Bitcoin Core's consensus behavior.

Recommended action

Review whether this sigop-counting logic is used anywhere in production validation paths. If so, backport the fix and add the regression test. Even if only used for diagnostics or fee estimation, update to match consensus behavior to avoid divergence from Bitcoin Core.

Security signals we found

01

Consensus-critical code path modified (transaction/script sigop counting)

02

Mismatch with Bitcoin Core consensus logic explicitly cited in commit message

03

Stale-cache bug could produce incorrect sigop counts

04

Incorrect sigop counts can affect transaction validity, fee estimation, and block validation limits

Risk score

Why this scored 60/100

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