diff --git a/lib/primitives/tx.js b/lib/primitives/tx.js index 2849e039..231f0bbb 100644 --- a/lib/primitives/tx.js +++ b/lib/primitives/tx.js @@ -665,9 +665,11 @@ TX.prototype.signatureHashV1 = function signatureHashV1(index, prev, value, type if (!this.mutable) this._hashOutputs = outputs; } - } else if ((type & 0x1f) === hashType.SINGLE && index < this.outputs.length) { - const output = this.outputs[index]; - outputs = digest.hash256(output.toRaw()); + } else if ((type & 0x1f) === hashType.SINGLE) { + if (index < this.outputs.length) { + const output = this.outputs[index]; + outputs = digest.hash256(output.toRaw()); + } } const size = 156 + prev.getVarSize();