trezor / trezor-firmware

:lock: Trezor Firmware Monorepo
https://trezor.io
Other
1.36k stars 661 forks source link

`build_tx.py` is not working #4191

Closed onvej-sl closed 1 month ago

onvej-sl commented 1 month ago

The tool python/tools/build_tx.py doesn't allow me to exit the loop where inputs are entered:

Coin name [Bitcoin]: 
Blockbook server [btc1.trezor.io]: 

Previous output to spend (txid:vout) []: 1570416eb4302cf52979afd5e6909e37d8fdd874301f7cc87e547e509cb1caa6:0
From address: 1HWDaLTpTCTtRWyWqZkzWx1wex5NKyncLW
Input amount: 100000000
BIP-32 path to derive the key: m/44h/0h/0h/0/0
Script type: SPENDADDRESS
Sequence Number to use (RBF opt-in enabled by default) [4294967293]: 

Previous output to spend (txid:vout) []: 
Error: 
Previous output to spend (txid:vout) []: 

It can be fixed for example by this patch:

diff --git a/python/tools/build_tx.py b/python/tools/build_tx.py
index 12aabc768..422ec37fa 100755
--- a/python/tools/build_tx.py
+++ b/python/tools/build_tx.py
@@ -62,7 +62,9 @@ def _default_script_type(address_n: Optional[List[int]], script_types: Any) -> s
     # return script_types[script_type]

-def parse_vin(s: str) -> Tuple[bytes, int]:
+def parse_vin(s: str) -> Optional[Tuple[bytes, int]]:
+    if not s:
+        return None
     txid, vout = s.split(":")
     return bytes.fromhex(txid), int(vout)
matejcik commented 1 month ago

fixed here: https://github.com/trezor/trezor-firmware/pull/4092