Skip to content

Commit 57a3700

Browse files
committed
TxBuilder: fix OP_0 in buildComplete
1 parent 67b4747 commit 57a3700

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/transaction_builder.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,15 @@ TransactionBuilder.prototype.__build = function (allowIncomplete) {
238238
})
239239

240240
// fill in blanks with OP_0
241-
for (var i = 0; i < msSignatures.length; ++i) {
242-
if (msSignatures[i]) continue
243-
244-
msSignatures[i] = ops.OP_0
241+
if (allowIncomplete) {
242+
for (var i = 0; i < msSignatures.length; ++i) {
243+
if (msSignatures[i]) continue
244+
245+
msSignatures[i] = ops.OP_0
246+
}
247+
} else {
248+
// Array.prototype.filter returns non-sparse array
249+
msSignatures = msSignatures.filter(function (x) { return x })
245250
}
246251

247252
var redeemScript = allowIncomplete ? undefined : input.redeemScript

0 commit comments

Comments
 (0)