From eb408ea706f4b64f6930af95f1ed2208f36da01d Mon Sep 17 00:00:00 2001 From: Sergei Boiko <127754187+satoshiotomakan@users.noreply.github.com> Date: Fri, 6 Dec 2024 21:56:35 +0700 Subject: [PATCH] [BRC20]: Fix bug when revealing BRC20 with extra P2TR (#4152) --- .../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