txbuilder: fix canSign returning true for missing witness value

This commit is contained in:
Daniel Cousens 2017-09-26 18:43:08 +10:00
parent 7795ffd328
commit eb6eac67b0

View file

@ -663,7 +663,10 @@ function canSign (input) {
input.signatures !== undefined && input.signatures !== undefined &&
input.signatures.length === input.pubKeys.length && input.signatures.length === input.pubKeys.length &&
input.pubKeys.length > 0 && 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) { TransactionBuilder.prototype.sign = function (vin, keyPair, redeemScript, hashType, witnessValue, witnessScript) {