Skip to content

Commit 421e618

Browse files
committed
and_n syntactic sugar was not being properly parsed
1 parent a12cdc8 commit 421e618

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"descriptors"
1212
],
1313
"homepage": "https://bitcoinerlab.com/modules/miniscript",
14-
"version": "1.1.0",
14+
"version": "1.1.1",
1515
"description": "Bitcoin Miniscript, a high-level language for describing Bitcoin spending conditions. It includes a Policy and Miniscript compiler, as well as a novel Satisfier for generating expressive witness scripts.",
1616
"main": "dist/index.js",
1717
"types": "types/index.d.ts",

src/satisfier/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ const evaluate = miniscript => {
201201
.replace(/^pk\(/, 'c:pk_k(')
202202
.replace(/^pkh\(/, 'c:pk_h(')
203203
.replace(/^and_n\(.*\)/, match =>
204-
match.replace('and_n', 'andor').replace(')', ',0)')
204+
match.replace('and_n', 'andor').replace(/\)$/, ',0)')
205205
)
206206
.replace(/^t:(.*)/, match => match.replace('t:', 'and_v(') + ',1)')
207207
.replace(/^l:(.*)/, match => match.replace('l:', 'or_i(0,') + ')')

test/fixtures.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,5 +825,16 @@ export const other = {
825825
}
826826
],
827827
malleableSats: []
828-
}
828+
},
829+
'thresh(1,pkh(@0),a:and_n(multi(1,@1,@2),n:older(2)))': {
830+
miniscript: 'thresh(1,pkh(@0),a:and_n(multi(1,@1,@2),n:older(2)))',
831+
script:
832+
'OP_DUP OP_HASH160 <HASH160(@0)> OP_EQUALVERIFY OP_CHECKSIG OP_TOALTSTACK 1 <@1> <@2> 2 OP_CHECKMULTISIG OP_NOTIF 0 OP_ELSE 2 OP_CHECKSEQUENCEVERIFY OP_0NOTEQUAL OP_ENDIF OP_FROMALTSTACK OP_ADD 1 OP_EQUAL',
833+
nonMalleableSats: [
834+
{ asm: '0 0 <sig(@0)> <@0>' },
835+
{ asm: '0 <sig(@1)> 0 <@0>', nSequence: 2 },
836+
{ asm: '0 <sig(@2)> 0 <@0>', nSequence: 2 }
837+
],
838+
malleableSats: []
839+
}
829840
};

0 commit comments

Comments
 (0)