diff --git a/test/fixtures/transaction_builder.json b/test/fixtures/transaction_builder.json index aee7e90..abc850d 100644 --- a/test/fixtures/transaction_builder.json +++ b/test/fixtures/transaction_builder.json @@ -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", "exception": "key pair cannot sign for this input", diff --git a/test/transaction_builder.js b/test/transaction_builder.js index 7f5c7c9..a4048f5 100644 --- a/test/transaction_builder.js +++ b/test/transaction_builder.js @@ -195,7 +195,8 @@ describe('TransactionBuilder', function () { f.inputs.forEach(function (input, index) { 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 if (sign.redeemScript) {