txb: enforce outputs exist when signing
This commit is contained in:
parent
acdfb34545
commit
ed1c1a5661
3 changed files with 26 additions and 2 deletions
test
17
test/fixtures/transaction_builder.json
vendored
17
test/fixtures/transaction_builder.json
vendored
|
@ -2357,6 +2357,23 @@
|
|||
"value": 1000
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Transaction w/ no outputs",
|
||||
"exception": "Transaction needs outputs",
|
||||
"inputs": [
|
||||
{
|
||||
"txId": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"vout": 0,
|
||||
"signs": [
|
||||
{
|
||||
"keyPair": "KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn",
|
||||
"throws": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": []
|
||||
}
|
||||
],
|
||||
"fromTransaction": [
|
||||
|
|
|
@ -313,6 +313,7 @@ describe('TransactionBuilder', function () {
|
|||
it('throws if if there exist any scriptSigs', function () {
|
||||
const txb = new TransactionBuilder()
|
||||
txb.addInput(txHash, 0)
|
||||
txb.addOutput(scripts[0], 100)
|
||||
txb.sign(0, keyPair)
|
||||
|
||||
assert.throws(function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue