diff --git a/src/transaction_builder.js b/src/transaction_builder.js index 3ec3d6e..2e11fc5 100644 --- a/src/transaction_builder.js +++ b/src/transaction_builder.js @@ -15,11 +15,18 @@ const ECPair = require('./ecpair') const Transaction = require('./transaction') function supportedType (type) { - return SIGNABLE.indexOf(type) !== -1 + return [ + btemplates.types.P2PKH, + btemplates.types.P2PK, + btemplates.types.MULTISIG + ].indexOf(type) !== -1 } function supportedP2SHType (type) { - return P2SH.indexOf(type) !== -1 + return supportedType(type) || [ + btemplates.types.P2WPKH, + btemplates.types.P2WSH + ].indexOf(type) !== -1 } function extractChunks (type, chunks, script) { diff --git a/test/fixtures/transaction_builder.json b/test/fixtures/transaction_builder.json index 9393de5..329b5a7 100644 --- a/test/fixtures/transaction_builder.json +++ b/test/fixtures/transaction_builder.json @@ -909,7 +909,7 @@ "locktime": 1170 }, { - "description": "Sighash V1: P2MS 6/6", + "description": "Sighash V1: P2WSH(P2SH(P2MS 6/6))", "txHex": "0100000000010136641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e0100000023220020a16b5755f7f6f96dbd65f5f0d6ab9418b89af4b1f14a1bb8a09062c35f0dcb54ffffffff02e6312761010000001976a914389ffce9cd9ae88dcc0631e88a821ffdbe9bfe2688ac583e0f00000000001976a9147480a33f950689af511e6e84c138dbbd3c3ee41588ac0800483045022100f902f491c4df15199e584790ae8c7202569a977accac0a09fa3f4f3b6ec3517602205961a951c4a12fa966da67b6fd75975b9de156b9895f8ab5f289ecaee12b9b3501473044022068c7946a43232757cbdf9176f009a928e1cd9a1a8c212f15c1e11ac9f2925d9002205b75f937ff2f9f3c1246e547e54f62e027f64eefa2695578cc6432cdabce271502483045022100bd5294e145d729e9593f49079b74e6e4b8aeba63440408595ce0949d5c6450a702207f9c9fb45907fe0180d3f4bee499006007bb90894b5f824a26dfa5d3afec543303483045022100febf9409d7f3c091ddc4d296a483aae7b3d2a91d38f6ea2a153f7ff085fe7766022078d11972c74cd78f816152463a5e1a5d986dfb94b55cf5f7242e4f6d5df000ff81483045022100a5263ea0553ba89221984bd7f0b13613db16e7a70c549a86de0cc0444141a407022005c360ef0ae5a5d4f9f2f87a56c1546cc8268cab08c73501d6b3be2e1e1a8a088247304402201a0e125aed6a700e45d6c86017d5a9d2264c8079319d868f3f163f5d63cb5bfe02200887608f2322ca0d82df67316275371028b0b21750417d594117963fe23b67ec83cf56210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b56ae00000000", "version": 1, "inputs": [