diff --git a/src/cjs/payments/p2ms.cjs b/src/cjs/payments/p2ms.cjs index 9a40c7077..a7b1eacc5 100644 --- a/src/cjs/payments/p2ms.cjs +++ b/src/cjs/payments/p2ms.cjs @@ -90,7 +90,7 @@ function p2ms(a, opts) { function isAcceptableSignature(x) { return ( bscript.isCanonicalScriptSignature(x) || - (opts.allowIncomplete && x === OPS.OP_0) !== undefined + !!(opts.allowIncomplete && x === OPS.OP_0) ); } v.parse( diff --git a/src/esm/payments/p2ms.js b/src/esm/payments/p2ms.js index 2d82e510e..58bc7a5fd 100644 --- a/src/esm/payments/p2ms.js +++ b/src/esm/payments/p2ms.js @@ -43,7 +43,7 @@ export function p2ms(a, opts) { function isAcceptableSignature(x) { return ( bscript.isCanonicalScriptSignature(x) || - (opts.allowIncomplete && x === OPS.OP_0) !== undefined + !!(opts.allowIncomplete && x === OPS.OP_0) ); } v.parse( diff --git a/test/fixtures/p2ms.json b/test/fixtures/p2ms.json index fe9d0d6bb..586be3271 100644 --- a/test/fixtures/p2ms.json +++ b/test/fixtures/p2ms.json @@ -407,6 +407,17 @@ "input": "OP_0 ffffffffffffffff" } }, + { + "description": "Invalid signature rejected even with allowIncomplete", + "exception": "Input has invalid signature\\(s\\)", + "options": { + "allowIncomplete": true + }, + "arguments": { + "output": "OP_1 030000000000000000000000000000000000000000000000000000000000000001 OP_1 OP_CHECKMULTISIG", + "input": "OP_0 ffffffffffffffff" + } + }, { "description": "n > 20 (2-of-21 multisig)", "exception": "Output is invalid", diff --git a/ts_src/payments/p2ms.ts b/ts_src/payments/p2ms.ts index 862448a6a..a998237a9 100644 --- a/ts_src/payments/p2ms.ts +++ b/ts_src/payments/p2ms.ts @@ -47,7 +47,7 @@ export function p2ms(a: Payment, opts?: PaymentOpts): Payment { function isAcceptableSignature(x: Uint8Array | number): boolean { return ( bscript.isCanonicalScriptSignature(x as Uint8Array) || - (opts!.allowIncomplete && (x as number) === OPS.OP_0) !== undefined + !!(opts!.allowIncomplete && (x as number) === OPS.OP_0) ); }