From 0fbc2023f21dedb270e4e479c826ff706409df76 Mon Sep 17 00:00:00 2001 From: David Kaplan Date: Tue, 3 Feb 2026 16:12:27 -0500 Subject: [PATCH] feat(abstract-utxo): simplify BIP322 message verification Remove unnecessary check for nonWitnessUtxo and its contents verification. The toSpend transaction ID check is sufficient for validation purposes. Co-authored-by: llm-git TICKET: BTC-2998 --- .../src/transaction/fixedScript/explainTransaction.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/modules/abstract-utxo/src/transaction/fixedScript/explainTransaction.ts b/modules/abstract-utxo/src/transaction/fixedScript/explainTransaction.ts index 052184a5a8..42f284be1d 100644 --- a/modules/abstract-utxo/src/transaction/fixedScript/explainTransaction.ts +++ b/modules/abstract-utxo/src/transaction/fixedScript/explainTransaction.ts @@ -318,17 +318,10 @@ function getBip322MessageInfoAndVerify(psbt: bitgo.UtxoPsbt, coinName: UtxoCoinN if (!input.witnessUtxo) { throw new Error(`Missing witnessUtxo for input index ${i}`); } - if (!input.nonWitnessUtxo) { - throw new Error(`Missing nonWitnessUtxo for input index ${i}`); - } const scriptPubKey = input.witnessUtxo.script; // Verify that the toSpend transaction can be recreated in the PSBT and is encoded correctly in the nonWitnessUtxo const toSpend = bip322.buildToSpendTransaction(scriptPubKey, message); - const toSpendB64 = toSpend.toBuffer().toString('base64'); - if (input.nonWitnessUtxo.toString('base64') !== toSpendB64) { - throw new Error(`Non-witness UTXO does not match the expected toSpend transaction at input index ${i}`); - } // Verify that the toSpend transaction ID matches the input's referenced transaction ID if (toSpend.getId() !== utxolib.bitgo.getOutputIdForInput(psbt.txInputs[i]).txid) {