Jonathan Underwood
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
17 additions and
3 deletions
-
src/payments/p2ms.js
-
src/transaction_builder.js
-
test/fixtures/p2ms.json
|
|
@ -129,7 +129,7 @@ function p2ms (a, opts) { |
|
|
|
if (a.input[0] !== OPS.OP_0) throw new TypeError('Input is invalid') |
|
|
|
if (o.signatures.length === 0 || !o.signatures.every(isAcceptableSignature)) throw new TypeError('Input has invalid signature(s)') |
|
|
|
|
|
|
|
if (a.signatures && !stacksEqual(a.signatures.equals(o.signatures))) throw new TypeError('Signature mismatch') |
|
|
|
if (a.signatures && !stacksEqual(a.signatures, o.signatures)) throw new TypeError('Signature mismatch') |
|
|
|
if (a.m !== undefined && a.m !== a.signatures.length) throw new TypeError('Signature count mismatch') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
@ -217,7 +217,7 @@ function expandOutput (script, ourPubKey) { |
|
|
|
return { type } |
|
|
|
} |
|
|
|
|
|
|
|
function prepareInput (input, ourPubKey, redeemScript, witnessValue, witnessScript) { |
|
|
|
function prepareInput (input, ourPubKey, redeemScript, witnessScript) { |
|
|
|
if (redeemScript && witnessScript) { |
|
|
|
const p2wsh = payments.p2wsh({ redeem: { output: witnessScript } }) |
|
|
|
const p2wshAlt = payments.p2wsh({ output: redeemScript }) |
|
|
@ -665,7 +665,7 @@ TransactionBuilder.prototype.sign = function (vin, keyPair, redeemScript, hashTy |
|
|
|
} |
|
|
|
|
|
|
|
if (!canSign(input)) { |
|
|
|
const prepared = prepareInput(input, ourPubKey, redeemScript, witnessValue, witnessScript) |
|
|
|
const prepared = prepareInput(input, ourPubKey, redeemScript, witnessScript) |
|
|
|
|
|
|
|
// updates inline
|
|
|
|
Object.assign(input, prepared) |
|
|
|
|
|
@ -310,6 +310,20 @@ |
|
|
|
] |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
"exception": "Signature mismatch", |
|
|
|
"arguments": { |
|
|
|
"m": 1, |
|
|
|
"pubkeys": [ |
|
|
|
"030000000000000000000000000000000000000000000000000000000000000001", |
|
|
|
"030000000000000000000000000000000000000000000000000000000000000001" |
|
|
|
], |
|
|
|
"signatures": [ |
|
|
|
"300602010002010001" |
|
|
|
], |
|
|
|
"input": "OP_0 300602010002010101" |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
"exception": "Too many signatures provided", |
|
|
|
"arguments": { |
|
|
|