Skip to content

Commit eb6eac6

Browse files
committed
txbuilder: fix canSign returning true for missing witness value
1 parent 7795ffd commit eb6eac6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/transaction_builder.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,10 @@ function canSign (input) {
663663
input.signatures !== undefined &&
664664
input.signatures.length === input.pubKeys.length &&
665665
input.pubKeys.length > 0 &&
666-
input.witness !== undefined
666+
(
667+
input.witness === false ||
668+
(input.witness === true && input.value !== undefined)
669+
)
667670
}
668671

669672
TransactionBuilder.prototype.sign = function (vin, keyPair, redeemScript, hashType, witnessValue, witnessScript) {

0 commit comments

Comments
 (0)