From 0fabe06667d8b41910aafe515054d45c78fff065 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Sat, 23 Nov 2024 08:42:23 +0000 Subject: [PATCH] Improve p2wpkh behavior when inputSighash is undefined --- src/transaction.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/transaction.ts b/src/transaction.ts index 952c680..4732551 100644 --- a/src/transaction.ts +++ b/src/transaction.ts @@ -381,7 +381,8 @@ export class Transaction { // We will lose some vectors -> smaller test coverage of preimages (very important!) private inputSighash(idx: number) { this.checkInputIdx(idx); - const sighash = getInputType(this.inputs[idx], this.opts.allowLegacyWitnessUtxo).sighash; + const inputSighash = this.inputs[idx].sighashType; + const sighash = inputSighash === undefined ? SignatureHash.DEFAULT : inputSighash; // ALL or DEFAULT -- everything signed // NONE -- all inputs + no outputs // SINGLE -- all inputs + output with same index