Commit message · Salvatore IngalaAlign miniscript type and ops computations with bitcoin-core
Fixes several discrepancies, all making the analysis stricter than
necessary, which could cause valid policies to be rejected:
- and_n(X,Y) is andor(X,Y,0): since 0 has the 's' property, non-
malleability does not require s_X or s_Y; and the dissatisfaction
of Y is never executed, so it does not contribute to the ops count.
- thresh: the timelock mixing check compared each child with the
accumulated timelocks including its own, so a child with different
kinds of timelocks in separate branches was flagged as mixing.
Also aligns the 'e' property of or_b, thresh and d: with bitcoin-core.
This has no effect on the final result, since the computed 'e' only
differed for nodes that are not 'm'.
A previous non-regression test lost its coverage after these changes;
wrapping the child in ltv: makes sure that it has e=1 but m=0, and the
test properly checks that thresh requires all the children to have 'm'.
As a reference, compare with:
https://github.com/bitcoin/bitcoin/blob/3eca89820e1fb152ebf0315e3924fc374cb35958/src/script/miniscript.cpp#L119-L230
https://github.com/bitcoin/bitcoin/blob/3eca89820e1fb152ebf0315e3924fc374cb35958/src/script/miniscript.h#L1046-L1051
Implementation and tests from Claude Opus 5.5.
91/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
Why it was queuedfuzzing or regression evidencesigning or wallet pathsecond-pass: security-sensitive path
AI analysis · Low 48/100This commit fixes the Ledger Bitcoin app's internal checker for Miniscript wallet policies. The checker was incorrectly rejecting some valid Bitcoin spending policies as unsafe, and in a few places it was computing safety properties using formulas that differ from the reference implementation in Bitcoin Core. The changes make the Ledger app match Bitcoin Core's stricter-but-correct rules. There is no direct evidence in the commit that user funds were at risk of theft; the main effect was that legitimate wallet setups could be wrongly rejected.