diff --git a/core/src/apps/bitcoin/sign_tx/approvers.py b/core/src/apps/bitcoin/sign_tx/approvers.py index a65db4a8e9..639a692750 100644 --- a/core/src/apps/bitcoin/sign_tx/approvers.py +++ b/core/src/apps/bitcoin/sign_tx/approvers.py @@ -118,6 +118,7 @@ class Approver: self, txo: TxOutput, script_pubkey: bytes, + index: int | None = None, orig_txo: TxOutput | None = None, ) -> None: await self._add_output(txo, script_pubkey) @@ -184,11 +185,12 @@ class BasicApprover(Approver): self, txo: TxOutput, script_pubkey: bytes, + index: int | None = None, orig_txo: TxOutput | None = None, ) -> None: from trezor.enums import OutputScriptType - await super().add_external_output(txo, script_pubkey, orig_txo) + await super().add_external_output(txo, script_pubkey, index, orig_txo) if orig_txo: if txo.amount < orig_txo.amount: diff --git a/core/src/apps/bitcoin/sign_tx/bitcoin.py b/core/src/apps/bitcoin/sign_tx/bitcoin.py index 451ac48d38..0474d3c548 100644 --- a/core/src/apps/bitcoin/sign_tx/bitcoin.py +++ b/core/src/apps/bitcoin/sign_tx/bitcoin.py @@ -223,7 +223,7 @@ class Bitcoin: orig_txo: TxOutput | None = None if txo.orig_hash: orig_txo = await self.get_original_output(txo, script_pubkey) - await self.approve_output(txo, script_pubkey, orig_txo) + await self.approve_output(txo, script_pubkey, orig_txo, i) # Finalize original outputs. for orig in self.orig_txs: @@ -507,6 +507,7 @@ class Bitcoin: txo: TxOutput, script_pubkey: bytes, orig_txo: TxOutput | None, + index: int | None, ) -> None: payment_req_index = txo.payment_req_index # local_cache_attribute approver = self.approver # local_cache_attribute @@ -525,7 +526,7 @@ class Bitcoin: # Output is change and does not need approval. await approver.add_change_output(txo, script_pubkey) else: - await approver.add_external_output(txo, script_pubkey, orig_txo) + await approver.add_external_output(txo, script_pubkey, index, orig_txo) self.tx_info.add_output(txo, script_pubkey) diff --git a/core/src/apps/bitcoin/sign_tx/decred.py b/core/src/apps/bitcoin/sign_tx/decred.py index fd39159038..2b37524e8c 100644 --- a/core/src/apps/bitcoin/sign_tx/decred.py +++ b/core/src/apps/bitcoin/sign_tx/decred.py @@ -99,7 +99,9 @@ class DecredApprover(BasicApprover): ) -> None: # NOTE: The following calls Approver.add_external_output(), not BasicApprover.add_external_output(). # This is needed to skip calling helpers.confirm_output(), which is what BasicApprover would do. - await super(BasicApprover, self).add_external_output(txo, script_pubkey, None) + await super(BasicApprover, self).add_external_output( + txo, script_pubkey, None, None + ) await helpers.confirm_decred_sstx_submission(txo, self.coin, self.amount_unit) @@ -206,8 +208,9 @@ class Decred(Bitcoin): txo: TxOutput, script_pubkey: bytes, orig_txo: TxOutput | None, + index: int | None, ) -> None: - await super().approve_output(txo, script_pubkey, orig_txo) + await super().approve_output(txo, script_pubkey, orig_txo, index) if self.serialize: self.write_tx_output(self.serialized_tx, txo, script_pubkey)