From 0d0fb3e33efaa6bb932daf8c693f4425eba9ea85 Mon Sep 17 00:00:00 2001 From: Satoshi Otomakan Date: Thu, 5 Dec 2024 21:10:06 +0100 Subject: [PATCH] [BRC20]: Fix bug when revealing BRC20 with extra P2TR --- .../tw_utxo/src/modules/sighash_computer.rs | 14 ++-- .../chains/bitcoin/bitcoin_sign/brc20.rs | 74 +++++++++++++++++++ 2 files changed, 82 insertions(+), 6 deletions(-) diff --git a/rust/frameworks/tw_utxo/src/modules/sighash_computer.rs b/rust/frameworks/tw_utxo/src/modules/sighash_computer.rs index 0bcfb626960..f2ee8880590 100644 --- a/rust/frameworks/tw_utxo/src/modules/sighash_computer.rs +++ b/rust/frameworks/tw_utxo/src/modules/sighash_computer.rs @@ -60,11 +60,11 @@ where .input_args() .iter() .enumerate() - .map(|(input_index, utxo)| { + .map(|(signing_input_index, utxo)| { let signing_method = utxo.signing_method; let utxo_args = UtxoPreimageArgs { - input_index, + input_index: signing_input_index, script_pubkey: utxo.script_pubkey.clone(), amount: utxo.amount, // TODO move `leaf_hash_code_separator` to `UtxoTaprootPreimageArgs`. @@ -90,12 +90,14 @@ where let tr_spent_script_pubkeys: Vec