Skip to content

Commit 0fbc202

Browse files
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 <llm-git@ttll.de> TICKET: BTC-2998
1 parent 2c8b6c3 commit 0fbc202

1 file changed

Lines changed: 0 additions & 7 deletions

File tree

modules/abstract-utxo/src/transaction/fixedScript/explainTransaction.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,10 @@ function getBip322MessageInfoAndVerify(psbt: bitgo.UtxoPsbt, coinName: UtxoCoinN
318318
if (!input.witnessUtxo) {
319319
throw new Error(`Missing witnessUtxo for input index ${i}`);
320320
}
321-
if (!input.nonWitnessUtxo) {
322-
throw new Error(`Missing nonWitnessUtxo for input index ${i}`);
323-
}
324321
const scriptPubKey = input.witnessUtxo.script;
325322

326323
// Verify that the toSpend transaction can be recreated in the PSBT and is encoded correctly in the nonWitnessUtxo
327324
const toSpend = bip322.buildToSpendTransaction(scriptPubKey, message);
328-
const toSpendB64 = toSpend.toBuffer().toString('base64');
329-
if (input.nonWitnessUtxo.toString('base64') !== toSpendB64) {
330-
throw new Error(`Non-witness UTXO does not match the expected toSpend transaction at input index ${i}`);
331-
}
332325

333326
// Verify that the toSpend transaction ID matches the input's referenced transaction ID
334327
if (toSpend.getId() !== utxolib.bitgo.getOutputIdForInput(psbt.txInputs[i]).txid) {

0 commit comments

Comments
 (0)