1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-01 20:08:26 +00:00

signtx: confirm output before hashing

This commit is contained in:
Jan Pochyla 2016-11-15 11:52:41 +01:00
parent 90d9687678
commit a798a07220

View File

@ -130,15 +130,15 @@ async def sign_tx(tx: SignTx, root):
raise SigningError(FailureType.Other, raise SigningError(FailureType.Other,
'Only one change output is valid') 'Only one change output is valid')
change_out = txo.amount change_out = txo.amount
else:
if not await confirm_output(txo, coin):
raise SigningError(FailureType.ActionCancelled,
'Output cancelled')
txo_bin.amount = txo.amount txo_bin.amount = txo.amount
txo_bin.script_pubkey = output_derive_script(txo, coin, root) txo_bin.script_pubkey = output_derive_script(txo, coin, root)
write_tx_output(h_first, txo_bin) write_tx_output(h_first, txo_bin)
total_out += txo_bin.amount total_out += txo_bin.amount
if not output_is_change(txo) and not await confirm_output(txo, coin):
raise SigningError(FailureType.ActionCancelled,
'Output cancelled')
fee = total_in - total_out fee = total_in - total_out
if fee < 0: if fee < 0: