wallet/get_address: support segwit

This commit is contained in:
Jan Pochyla 2017-11-23 17:35:27 +01:00
parent 7de6a082d3
commit 7a0bfd289b
3 changed files with 5 additions and 5 deletions

View File

@ -8,17 +8,19 @@ async def layout_get_address(ctx, msg):
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.get_root(ctx)
node.derive_path(address_n)
coin = coins.by_name(coin_name)
address = node.address(coin.address_type)
address = addresses.get_address(msg.script_type, coin, node)
if msg.show_display:
await _show_address(ctx, address)

View File

@ -16,7 +16,7 @@ class AddressError(Exception):
pass
def get_address(script_type: InputScriptType, coin: CoinType, node) -> bytes:
def get_address(script_type: InputScriptType, coin: CoinType, node) -> str:
if script_type == InputScriptType.SPENDADDRESS: # p2pkh
return node.address(coin.address_type)

View File

@ -17,8 +17,6 @@ pytest \
--ignore test_msg_ethereum_signmessage.py \
--ignore test_msg_ethereum_signtx.py \
--ignore test_msg_ethereum_verifymessage.py \
--ignore test_msg_getaddress_segwit_native.py \
--ignore test_msg_getaddress_segwit.py \
--ignore test_msg_getaddress_show.py \
--ignore test_msg_loaddevice_xprv.py \
--ignore test_msg_nem_getaddress.py \