mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-04 05:42:34 +00:00
TR-core: show output indexes
This commit is contained in:
parent
84acfac493
commit
abf75efbed
@ -118,6 +118,7 @@ class Approver:
|
|||||||
self,
|
self,
|
||||||
txo: TxOutput,
|
txo: TxOutput,
|
||||||
script_pubkey: bytes,
|
script_pubkey: bytes,
|
||||||
|
index: int | None = None,
|
||||||
orig_txo: TxOutput | None = None,
|
orig_txo: TxOutput | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
await self._add_output(txo, script_pubkey)
|
await self._add_output(txo, script_pubkey)
|
||||||
@ -184,11 +185,12 @@ class BasicApprover(Approver):
|
|||||||
self,
|
self,
|
||||||
txo: TxOutput,
|
txo: TxOutput,
|
||||||
script_pubkey: bytes,
|
script_pubkey: bytes,
|
||||||
|
index: int | None = None,
|
||||||
orig_txo: TxOutput | None = None,
|
orig_txo: TxOutput | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
from trezor.enums import OutputScriptType
|
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 orig_txo:
|
||||||
if txo.amount < orig_txo.amount:
|
if txo.amount < orig_txo.amount:
|
||||||
|
@ -223,7 +223,7 @@ class Bitcoin:
|
|||||||
orig_txo: TxOutput | None = None
|
orig_txo: TxOutput | None = None
|
||||||
if txo.orig_hash:
|
if txo.orig_hash:
|
||||||
orig_txo = await self.get_original_output(txo, script_pubkey)
|
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.
|
# Finalize original outputs.
|
||||||
for orig in self.orig_txs:
|
for orig in self.orig_txs:
|
||||||
@ -507,6 +507,7 @@ class Bitcoin:
|
|||||||
txo: TxOutput,
|
txo: TxOutput,
|
||||||
script_pubkey: bytes,
|
script_pubkey: bytes,
|
||||||
orig_txo: TxOutput | None,
|
orig_txo: TxOutput | None,
|
||||||
|
index: int | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
payment_req_index = txo.payment_req_index # local_cache_attribute
|
payment_req_index = txo.payment_req_index # local_cache_attribute
|
||||||
approver = self.approver # local_cache_attribute
|
approver = self.approver # local_cache_attribute
|
||||||
@ -525,7 +526,7 @@ class Bitcoin:
|
|||||||
# Output is change and does not need approval.
|
# Output is change and does not need approval.
|
||||||
await approver.add_change_output(txo, script_pubkey)
|
await approver.add_change_output(txo, script_pubkey)
|
||||||
else:
|
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)
|
self.tx_info.add_output(txo, script_pubkey)
|
||||||
|
|
||||||
|
@ -99,7 +99,9 @@ class DecredApprover(BasicApprover):
|
|||||||
) -> None:
|
) -> None:
|
||||||
# NOTE: The following calls Approver.add_external_output(), not BasicApprover.add_external_output().
|
# 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.
|
# 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)
|
await helpers.confirm_decred_sstx_submission(txo, self.coin, self.amount_unit)
|
||||||
|
|
||||||
|
|
||||||
@ -206,8 +208,9 @@ class Decred(Bitcoin):
|
|||||||
txo: TxOutput,
|
txo: TxOutput,
|
||||||
script_pubkey: bytes,
|
script_pubkey: bytes,
|
||||||
orig_txo: TxOutput | None,
|
orig_txo: TxOutput | None,
|
||||||
|
index: int | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
await super().approve_output(txo, script_pubkey, orig_txo)
|
await super().approve_output(txo, script_pubkey, orig_txo, index)
|
||||||
if self.serialize:
|
if self.serialize:
|
||||||
self.write_tx_output(self.serialized_tx, txo, script_pubkey)
|
self.write_tx_output(self.serialized_tx, txo, script_pubkey)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user