1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 21:48:13 +00:00

fix: clarify how to break out of build_tx loops

[no changelog]
This commit is contained in:
Ioan Bizău 2024-08-07 12:13:18 +02:00 committed by Ioan Bizău
parent 02533aa27a
commit c82fad68e7
2 changed files with 12 additions and 5 deletions

View File

@ -75,11 +75,14 @@ def _get_inputs_interactive(
while True:
echo()
prev = prompt(
"Previous output to spend (txid:vout)", type=parse_vin, default=""
"Previous output to spend (txid:vout / empty string to skip)", default=""
)
if not prev:
break
prev_hash, prev_index = prev
try:
prev_hash, prev_index = parse_vin(prev)
except Exception:
continue
txhash = prev_hash.hex()
tx_url = blockbook_url + txhash
@ -140,17 +143,21 @@ def _get_outputs_interactive() -> List[messages.TxOutputType]:
outputs: List[messages.TxOutputType] = []
while True:
echo()
address = prompt("Output address (for non-change output)", default="")
address = prompt("Output address for non-change output", default="")
if address:
address_n = None
script_type = messages.OutputScriptType.PAYTOADDRESS
else:
address = None
address_n = prompt(
"BIP-32 path (for change output)", type=tools.parse_path, default=""
"BIP-32 path for change output (empty string to skip)", default=""
)
if not address_n:
break
try:
address_n = tools.parse_path(address_n)
except Exception:
continue
script_type = prompt(
"Output type",
type=ChoiceType(OUTPUT_SCRIPTS),

View File

@ -4,7 +4,7 @@ specific inputs and outputs inspired by BTC device tests.
INPUTS and OUTPUTS lists are the only things needed to be modified.
Similar to tools/build_tx.py, but more suitable for bigger/autogenerated transactions.
Similar to python/tools/build_tx.py, but more suitable for bigger/autogenerated transactions.
The serialized transaction can then be announced to network at https://tbtc1.trezor.io/sendtx
It could be useful to inspect the transaction details at https://live.blockcypher.com/btc/decodetx/