Browse Source
Add test from bugfix, also remove unnecessary arg
fixTypes
junderw
6 years ago
No known key found for this signature in database
GPG Key ID: B256185D3A971908
2 changed files with
16 additions and
2 deletions
-
src/transaction_builder.ts
-
test/fixtures/p2ms.json
|
@ -279,7 +279,7 @@ export class TransactionBuilder { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!canSign(input)) { |
|
|
if (!canSign(input)) { |
|
|
const prepared = prepareInput(input, ourPubKey, redeemScript, witnessValue, witnessScript) |
|
|
const prepared = prepareInput(input, ourPubKey, redeemScript, witnessScript) |
|
|
|
|
|
|
|
|
// updates inline
|
|
|
// updates inline
|
|
|
Object.assign(input, prepared) |
|
|
Object.assign(input, prepared) |
|
@ -589,7 +589,7 @@ function expandOutput (script: Buffer, ourPubKey?: Buffer): TxbOutput { |
|
|
return { type } |
|
|
return { type } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function prepareInput (input: TxbInput, ourPubKey: Buffer, redeemScript: Buffer, witnessValue: number, witnessScript: Buffer): TxbInput { |
|
|
function prepareInput (input: TxbInput, ourPubKey: Buffer, redeemScript: Buffer, witnessScript: Buffer): TxbInput { |
|
|
if (redeemScript && witnessScript) { |
|
|
if (redeemScript && witnessScript) { |
|
|
const p2wsh = <Payment> payments.p2wsh({ redeem: { output: witnessScript } }) |
|
|
const p2wsh = <Payment> payments.p2wsh({ redeem: { output: witnessScript } }) |
|
|
const p2wshAlt = <Payment> payments.p2wsh({ output: redeemScript }) |
|
|
const p2wshAlt = <Payment> payments.p2wsh({ output: redeemScript }) |
|
|
|
@ -310,6 +310,20 @@ |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"exception": "Signature mismatch", |
|
|
|
|
|
"arguments": { |
|
|
|
|
|
"m": 1, |
|
|
|
|
|
"pubkeys": [ |
|
|
|
|
|
"030000000000000000000000000000000000000000000000000000000000000001", |
|
|
|
|
|
"030000000000000000000000000000000000000000000000000000000000000001" |
|
|
|
|
|
], |
|
|
|
|
|
"signatures": [ |
|
|
|
|
|
"300602010002010001" |
|
|
|
|
|
], |
|
|
|
|
|
"input": "OP_0 300602010002010101" |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
{ |
|
|
{ |
|
|
"exception": "Too many signatures provided", |
|
|
"exception": "Too many signatures provided", |
|
|
"arguments": { |
|
|
"arguments": { |
|
|