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

Fix ops computation for andor fragments

Public commit record

What the developer wrote

Authored by Salvatore Ingala

86/100 · Strong
Fix ops computation for andor fragments

An incorrect result might allow registering policies that can't
later be spent.

As a reference, compare with: https://github.com/bitcoin/bitcoin/blob/3eca89820e1fb152ebf0315e3924fc374cb35958/src/script/miniscript.h#L1046-L1051

Tests generated with Claude Opus 5.5.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a bug in how the Ledger Bitcoin app counts the number of Bitcoin script operations (ops) needed to spend certain wallet policies that use a 'miniscript andor' fragment. Because the count was wrong, the app could allow users to register wallet policies that look valid but cannot actually be spent later because they exceed Bitcoin's 201-op limit. The fix changes one variable in a formula so the correct dissatisfaction branch is counted, matching Bitcoin Core's reference implementation. New tests confirm the fix.

Recommended action

Review and merge the fix, then ensure the updated app is distributed to users. Wallet policies already registered under the buggy check should be considered potentially unspendable; users should be advised to re-register or verify affected policies after updating.

Security signals we found

01

Incorrect miniscript ops accounting for andor fragment

02

Policy sanity check bypass leading to unspendable registered wallets

03

Reference alignment with Bitcoin Core implementation

04

Regression tests added for the specific miscount

Risk score

Why this scored 68/100

Our methodology →
Potential impact 22/30
Exploitability 12/25
Stealth signal 10/15
Affected reach 10/15
Confidence 9/10
Evidence quality 5/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.