Skip to content

Commit acfe084

Browse files
Merge pull request #8046 from BitGo/BTC-2998.explain
feat(abstract-utxo): simplify BIP322 message verification
2 parents 510a249 + 0fbc202 commit acfe084

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)