TxBuilder: add test for missing redeemScript if P2SH
This commit is contained in:
parent
b3438c5ef2
commit
e5618bb8bd
1 changed files with 12 additions and 0 deletions
|
@ -110,6 +110,18 @@ describe('TransactionBuilder', function() {
|
|||
})
|
||||
})
|
||||
|
||||
describe('when redeemScript is undefined', function() {
|
||||
it('throws if prevOutScript is P2SH', function() {
|
||||
var privScriptP2SH = scripts.scriptHashOutput(privScript.getHash())
|
||||
|
||||
txb.addInput(prevTxHash, 0, undefined, privScriptP2SH)
|
||||
|
||||
assert.throws(function() {
|
||||
txb.sign(0, privKey)
|
||||
}, /PrevOutScript is P2SH, missing redeemScript/)
|
||||
})
|
||||
})
|
||||
|
||||
describe('when redeemScript is defined', function() {
|
||||
it('assumes scriptHash', function() {
|
||||
txb.addInput(prevTxHash, 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue