TR-core: show output indexes

grdddj/debuglink_improvements
grdddj 1 year ago
parent 84acfac493
commit abf75efbed

@ -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:

@ -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)

@ -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)

Loading…
Cancel
Save