diff --git a/src/apps/wallet/get_address.py b/src/apps/wallet/get_address.py index 6433c97d85..aef0b5db8c 100644 --- a/src/apps/wallet/get_address.py +++ b/src/apps/wallet/get_address.py @@ -1,24 +1,20 @@ from micropython import const -from trezor import wire, ui +from trezor import ui async def layout_get_address(ctx, msg): from trezor.messages.Address import Address from trezor.messages.InputScriptType import SPENDWITNESS - from trezor.messages.FailureType import ProcessError from ..common import coins from ..common import seed from ..wallet.sign_tx import addresses - if msg.multisig: - raise wire.FailureError(ProcessError, 'GetAddress.multisig is unsupported') - address_n = msg.address_n or () coin_name = msg.coin_name or 'Bitcoin' coin = coins.by_name(coin_name) node = await seed.derive_node(ctx, address_n) - address = addresses.get_address(msg.script_type, coin, node) + address = addresses.get_address(msg.script_type, coin, node, msg.multisig) if msg.show_display: while True: diff --git a/src/apps/wallet/sign_tx/addresses.py b/src/apps/wallet/sign_tx/addresses.py index ac13d10907..c75261cdb3 100644 --- a/src/apps/wallet/sign_tx/addresses.py +++ b/src/apps/wallet/sign_tx/addresses.py @@ -30,13 +30,18 @@ def get_address(script_type: InputScriptType, coin: CoinType, node, multisig=Non 'Segwit not enabled on this coin') return address_p2wpkh(node.public_key(), coin.bech32_prefix) - elif script_type == InputScriptType.SPENDP2SHWITNESS: # p2wpkh using p2sh + elif script_type == InputScriptType.SPENDP2SHWITNESS: # p2wpkh or p2wsh using p2sh if not coin.segwit or coin.address_type_p2sh is None: raise AddressError(FailureType.ProcessError, 'Segwit not enabled on this coin') + # p2wsh multisig + if multisig is not None: + return address_multisig_p2wsh_in_p2sh(multisig_get_pubkeys(multisig), multisig.m, coin.address_type_p2sh) + + # p2wpkh return address_p2wpkh_in_p2sh(node.public_key(), coin.address_type_p2sh) - elif script_type == InputScriptType.SPENDMULTISIG: # multisig + elif script_type == InputScriptType.SPENDMULTISIG: # p2sh multisig if multisig is None: raise AddressError(FailureType.ProcessError, 'Multisig details required')