From eb6eac67b07d7faf73a180bd23230eb09127962a Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Tue, 26 Sep 2017 18:43:08 +1000 Subject: [PATCH] txbuilder: fix canSign returning true for missing witness value --- src/transaction_builder.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/transaction_builder.js b/src/transaction_builder.js index e6adfd1..94d3037 100644 --- a/src/transaction_builder.js +++ b/src/transaction_builder.js @@ -663,7 +663,10 @@ function canSign (input) { input.signatures !== undefined && input.signatures.length === input.pubKeys.length && input.pubKeys.length > 0 && - input.witness !== undefined + ( + input.witness === false || + (input.witness === true && input.value !== undefined) + ) } TransactionBuilder.prototype.sign = function (vin, keyPair, redeemScript, hashType, witnessValue, witnessScript) {