mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 12:28:09 +00:00
feat(python): Raise ValueError for non-existant tx hashes
If the device asks for a tx_hash which is not present in prev_txes, raise a ValueError with some more detailed messaging about the missing hash rather than the default dictionary lookup failure of KeyError.
This commit is contained in:
parent
ff7d5c224b
commit
23a09fc047
1
python/.changelog.d/1442.changed
Normal file
1
python/.changelog.d/1442.changed
Normal file
@ -0,0 +1 @@
|
|||||||
|
Raise `ValueError` when the txid for an input is not present in `prev_txes` during `btc.sign_tx`
|
@ -334,6 +334,10 @@ def sign_tx(
|
|||||||
|
|
||||||
# Device asked for one more information, let's process it.
|
# Device asked for one more information, let's process it.
|
||||||
if res.details.tx_hash is not None:
|
if res.details.tx_hash is not None:
|
||||||
|
if res.details.tx_hash not in prev_txes:
|
||||||
|
raise ValueError(
|
||||||
|
f"Previous transaction {res.details.tx_hash.hex()} not available"
|
||||||
|
)
|
||||||
current_tx = prev_txes[res.details.tx_hash]
|
current_tx = prev_txes[res.details.tx_hash]
|
||||||
else:
|
else:
|
||||||
current_tx = this_tx
|
current_tx = this_tx
|
||||||
|
Loading…
Reference in New Issue
Block a user