Merge pull request #908 from bitcoinjs/txbfix

TxBuilder: fix canSign returning true for missing witness value
This commit is contained in:
Daniel Cousens 2017-09-26 20:02:55 +10:00 committed by GitHub
commit b6a6b0a50a

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) {