@@ -355,7 +355,7 @@ def get_pubkey_at_path(self, path: str) -> ExtendedKey:
355355 return xpub
356356
357357 @trezor_exception
358- def sign_tx (self , tx : PSBT ) -> PSBT :
358+ def sign_tx (self , psbt : PSBT ) -> PSBT :
359359 """
360360 Sign a transaction with the Trezor. There are some limitations to what transactions can be signed.
361361
@@ -378,7 +378,7 @@ def sign_tx(self, tx: PSBT) -> PSBT:
378378 # Prepare inputs
379379 inputs = []
380380 to_ignore = [] # Note down which inputs whose signatures we're going to ignore
381- for input_num , psbt_in in builtins .enumerate (tx .inputs ):
381+ for input_num , psbt_in in builtins .enumerate (psbt .inputs ):
382382 assert psbt_in .prev_txid is not None
383383 assert psbt_in .prev_out is not None
384384 assert psbt_in .sequence is not None
@@ -443,7 +443,7 @@ def ignore_input() -> None:
443443 to_ignore .append (input_num )
444444
445445 # Check for multisig
446- is_ms , multisig = parse_multisig (scriptcode , tx .xpub , psbt_in )
446+ is_ms , multisig = parse_multisig (scriptcode , psbt .xpub , psbt_in )
447447 if is_ms :
448448 # Add to txinputtype
449449 txinputtype .multisig = multisig
@@ -529,7 +529,7 @@ def ignore_input() -> None:
529529
530530 # prepare outputs
531531 outputs = []
532- for psbt_out in tx .outputs :
532+ for psbt_out in psbt .outputs :
533533 out = psbt_out .get_txout ()
534534 txoutput = messages .TxOutputType (amount = out .nValue )
535535 txoutput .script_type = messages .OutputScriptType .PAYTOADDRESS
@@ -578,7 +578,7 @@ def ignore_input() -> None:
578578 if psbt_out .witness_script or psbt_out .redeem_script :
579579 is_ms , multisig = parse_multisig (
580580 psbt_out .witness_script or psbt_out .redeem_script ,
581- tx .xpub , psbt_out )
581+ psbt .xpub , psbt_out )
582582 if is_ms :
583583 txoutput .multisig = multisig
584584 if not wit :
@@ -589,7 +589,7 @@ def ignore_input() -> None:
589589
590590 # Prepare prev txs
591591 prevtxs = {}
592- for psbt_in in tx .inputs :
592+ for psbt_in in psbt .inputs :
593593 if psbt_in .non_witness_utxo :
594594 prev = psbt_in .non_witness_utxo
595595
@@ -618,20 +618,20 @@ def ignore_input() -> None:
618618 prevtxs [ser_uint256 (psbt_in .non_witness_utxo .sha256 )[::- 1 ]] = t
619619
620620 # Sign the transaction
621- assert tx .tx_version is not None
621+ assert psbt .tx_version is not None
622622 signed_tx = btc .sign_tx (
623623 client = self .client ,
624624 coin_name = self .coin_name ,
625625 inputs = inputs ,
626626 outputs = outputs ,
627627 prev_txes = prevtxs ,
628- version = tx .tx_version ,
629- lock_time = tx .compute_lock_time (),
628+ version = psbt .tx_version ,
629+ lock_time = psbt .compute_lock_time (),
630630 serialize = False ,
631631 )
632632
633633 # Each input has one signature
634- for input_num , (psbt_in , sig ) in py_enumerate (list (zip (tx .inputs , signed_tx [0 ]))):
634+ for input_num , (psbt_in , sig ) in py_enumerate (list (zip (psbt .inputs , signed_tx [0 ]))):
635635 if input_num in to_ignore :
636636 continue
637637 for pubkey in psbt_in .hd_keypaths .keys ():
@@ -646,7 +646,7 @@ def ignore_input() -> None:
646646
647647 p += 1
648648
649- return tx
649+ return psbt
650650
651651 @trezor_exception
652652 def sign_message (self , message : Union [str , bytes ], keypath : str ) -> str :
0 commit comments