Skip to content

Commit 46c1991

Browse files
authored
Merge pull request bitcoinjs#1307 from bitcoinjs/bugFixes
Fix some small bugs
2 parents 293116b + 912d6d4 commit 46c1991

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/payments/p2ms.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function p2ms (a, opts) {
129129
if (a.input[0] !== OPS.OP_0) throw new TypeError('Input is invalid')
130130
if (o.signatures.length === 0 || !o.signatures.every(isAcceptableSignature)) throw new TypeError('Input has invalid signature(s)')
131131

132-
if (a.signatures && !stacksEqual(a.signatures.equals(o.signatures))) throw new TypeError('Signature mismatch')
132+
if (a.signatures && !stacksEqual(a.signatures, o.signatures)) throw new TypeError('Signature mismatch')
133133
if (a.m !== undefined && a.m !== a.signatures.length) throw new TypeError('Signature count mismatch')
134134
}
135135
}

src/transaction_builder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ function expandOutput (script, ourPubKey) {
217217
return { type }
218218
}
219219

220-
function prepareInput (input, ourPubKey, redeemScript, witnessValue, witnessScript) {
220+
function prepareInput (input, ourPubKey, redeemScript, witnessScript) {
221221
if (redeemScript && witnessScript) {
222222
const p2wsh = payments.p2wsh({ redeem: { output: witnessScript } })
223223
const p2wshAlt = payments.p2wsh({ output: redeemScript })
@@ -665,7 +665,7 @@ TransactionBuilder.prototype.sign = function (vin, keyPair, redeemScript, hashTy
665665
}
666666

667667
if (!canSign(input)) {
668-
const prepared = prepareInput(input, ourPubKey, redeemScript, witnessValue, witnessScript)
668+
const prepared = prepareInput(input, ourPubKey, redeemScript, witnessScript)
669669

670670
// updates inline
671671
Object.assign(input, prepared)

test/fixtures/p2ms.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,20 @@
310310
]
311311
}
312312
},
313+
{
314+
"exception": "Signature mismatch",
315+
"arguments": {
316+
"m": 1,
317+
"pubkeys": [
318+
"030000000000000000000000000000000000000000000000000000000000000001",
319+
"030000000000000000000000000000000000000000000000000000000000000001"
320+
],
321+
"signatures": [
322+
"300602010002010001"
323+
],
324+
"input": "OP_0 300602010002010101"
325+
}
326+
},
313327
{
314328
"exception": "Too many signatures provided",
315329
"arguments": {

0 commit comments

Comments
 (0)