mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-26 01:42:34 +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:
parent
da6cc4a6e5
commit
b98171e273
@ -121,10 +121,7 @@ async def check_tx_fee(tx: SignTx, root):
|
|||||||
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)
|
||||||
weight.add_output(txo_bin.script_pubkey)
|
weight.add_output(txo_bin.script_pubkey)
|
||||||
if is_change(txo, wallet_path, segwit_in, multisig_fp, multisig_fp_mismatch):
|
if (change_out == 0) and 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')
|
|
||||||
change_out = txo.amount
|
change_out = txo.amount
|
||||||
elif not await confirm_output(txo, coin):
|
elif not await confirm_output(txo, coin):
|
||||||
raise SigningError(FailureType.ActionCancelled,
|
raise SigningError(FailureType.ActionCancelled,
|
||||||
@ -493,7 +490,7 @@ def output_is_change(o: TxOutputType, wallet_path: list, segwit_in: int) -> bool
|
|||||||
return False
|
return False
|
||||||
return (address_n is not None and wallet_path is not None and
|
return (address_n is not None and wallet_path is not None and
|
||||||
wallet_path == address_n[:-_BIP32_WALLET_DEPTH] 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)
|
address_n[-1] <= _BIP32_MAX_LAST_ELEMENT)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user