diff --git a/package.json b/package.json index 2c0292d..333c42f 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "descriptors" ], "homepage": "https://bitcoinerlab.com/modules/miniscript", - "version": "1.1.0", + "version": "1.1.1", "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.", "main": "dist/index.js", "types": "types/index.d.ts", diff --git a/src/satisfier/index.js b/src/satisfier/index.js index 90779de..ecb6787 100644 --- a/src/satisfier/index.js +++ b/src/satisfier/index.js @@ -201,7 +201,7 @@ const evaluate = miniscript => { .replace(/^pk\(/, 'c:pk_k(') .replace(/^pkh\(/, 'c:pk_h(') .replace(/^and_n\(.*\)/, match => - match.replace('and_n', 'andor').replace(')', ',0)') + match.replace('and_n', 'andor').replace(/\)$/, ',0)') ) .replace(/^t:(.*)/, match => match.replace('t:', 'and_v(') + ',1)') .replace(/^l:(.*)/, match => match.replace('l:', 'or_i(0,') + ')') diff --git a/test/fixtures.js b/test/fixtures.js index 07c7ec8..4eaafad 100644 --- a/test/fixtures.js +++ b/test/fixtures.js @@ -825,5 +825,16 @@ export const other = { } ], malleableSats: [] - } + }, + 'thresh(1,pkh(@0),a:and_n(multi(1,@1,@2),n:older(2)))': { + miniscript: 'thresh(1,pkh(@0),a:and_n(multi(1,@1,@2),n:older(2)))', + script: + 'OP_DUP OP_HASH160 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', + nonMalleableSats: [ + { asm: '0 0 <@0>' }, + { asm: '0 0 <@0>', nSequence: 2 }, + { asm: '0 0 <@0>', nSequence: 2 } + ], + malleableSats: [] + } };