diff --git a/python/.changelog.d/1442.changed b/python/.changelog.d/1442.changed new file mode 100644 index 000000000..8da49b99e --- /dev/null +++ b/python/.changelog.d/1442.changed @@ -0,0 +1 @@ +Raise `ValueError` when the txid for an input is not present in `prev_txes` during `btc.sign_tx` diff --git a/python/src/trezorlib/btc.py b/python/src/trezorlib/btc.py index c8ae222e1..316e27be9 100644 --- a/python/src/trezorlib/btc.py +++ b/python/src/trezorlib/btc.py @@ -334,6 +334,10 @@ def sign_tx( # Device asked for one more information, let's process it. 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] else: current_tx = this_tx