1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-30 03:18:20 +00:00

signing: less paranoid change outputs

- Allow change to be on the main chain
- Allow more than one output to the Trezor, but don't treat it as change

based on e716f7e84e
This commit is contained in:
Tomas Susanka 2018-02-23 12:14:17 +01:00 committed by Jan Pochyla
parent da6cc4a6e5
commit b98171e273

View File

@ -121,10 +121,7 @@ async def check_tx_fee(tx: SignTx, root):
txo_bin.amount = txo.amount
txo_bin.script_pubkey = output_derive_script(txo, coin, root)
weight.add_output(txo_bin.script_pubkey)
if is_change(txo, wallet_path, segwit_in, multisig_fp, multisig_fp_mismatch):
if change_out != 0:
raise SigningError(FailureType.ProcessError,
'Only one change output is valid')
if (change_out == 0) and is_change(txo, wallet_path, segwit_in, multisig_fp, multisig_fp_mismatch):
change_out = txo.amount
elif not await confirm_output(txo, coin):
raise SigningError(FailureType.ActionCancelled,
@ -493,7 +490,7 @@ def output_is_change(o: TxOutputType, wallet_path: list, segwit_in: int) -> bool
return False
return (address_n is not None and wallet_path is not None and
wallet_path == address_n[:-_BIP32_WALLET_DEPTH] and
address_n[-2] == _BIP32_CHANGE_CHAIN and
address_n[-2] <= _BIP32_CHANGE_CHAIN and
address_n[-1] <= _BIP32_MAX_LAST_ELEMENT)