tests: add explicit test for inconsistent network exception
This commit is contained in:
parent
a4eb58f103
commit
7a6936674e
2 changed files with 26 additions and 1 deletions
24
test/fixtures/transaction_builder.json
vendored
24
test/fixtures/transaction_builder.json
vendored
|
@ -754,6 +754,30 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Wrong network for keyPair",
|
||||||
|
"exception": "Inconsistent network",
|
||||||
|
"network": "bitcoin",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"txId": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
|
"vout": 0,
|
||||||
|
"signs": [
|
||||||
|
{
|
||||||
|
"keyPair": "91avARGdfge8E4tZfYLoxeJ5sGBdNJQH4kvjJoQFacbgwmaKkrx",
|
||||||
|
"network": "testnet",
|
||||||
|
"throws": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"script": "OP_DUP OP_HASH160 aa4d7985c57e011a8b3dd8e0e5a73aaef41629c5 OP_EQUALVERIFY OP_CHECKSIG",
|
||||||
|
"value": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Wrong key pair for multisig redeemScript",
|
"description": "Wrong key pair for multisig redeemScript",
|
||||||
"exception": "key pair cannot sign for this input",
|
"exception": "key pair cannot sign for this input",
|
||||||
|
|
|
@ -195,7 +195,8 @@ describe('TransactionBuilder', function () {
|
||||||
|
|
||||||
f.inputs.forEach(function (input, index) {
|
f.inputs.forEach(function (input, index) {
|
||||||
input.signs.forEach(function (sign) {
|
input.signs.forEach(function (sign) {
|
||||||
var keyPair = ECPair.fromWIF(sign.keyPair, NETWORKS[f.network])
|
var keyPairNetwork = NETWORKS[sign.network || f.network]
|
||||||
|
var keyPair = ECPair.fromWIF(sign.keyPair, keyPairNetwork)
|
||||||
var redeemScript
|
var redeemScript
|
||||||
|
|
||||||
if (sign.redeemScript) {
|
if (sign.redeemScript) {
|
||||||
|
|
Loading…
Reference in a new issue