wallet/get_address: support segwit
This commit is contained in:
parent
7de6a082d3
commit
7a0bfd289b
|
@ -8,17 +8,19 @@ async def layout_get_address(ctx, msg):
|
||||||
from trezor.messages.FailureType import ProcessError
|
from trezor.messages.FailureType import ProcessError
|
||||||
from ..common import coins
|
from ..common import coins
|
||||||
from ..common import seed
|
from ..common import seed
|
||||||
|
from ..wallet.sign_tx import addresses
|
||||||
|
|
||||||
if msg.multisig:
|
if msg.multisig:
|
||||||
raise wire.FailureError(ProcessError, 'GetAddress.multisig is unsupported')
|
raise wire.FailureError(ProcessError, 'GetAddress.multisig is unsupported')
|
||||||
|
|
||||||
address_n = msg.address_n or ()
|
address_n = msg.address_n or ()
|
||||||
coin_name = msg.coin_name or 'Bitcoin'
|
coin_name = msg.coin_name or 'Bitcoin'
|
||||||
|
coin = coins.by_name(coin_name)
|
||||||
|
|
||||||
node = await seed.get_root(ctx)
|
node = await seed.get_root(ctx)
|
||||||
node.derive_path(address_n)
|
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:
|
if msg.show_display:
|
||||||
await _show_address(ctx, address)
|
await _show_address(ctx, address)
|
||||||
|
|
|
@ -16,7 +16,7 @@ class AddressError(Exception):
|
||||||
pass
|
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
|
if script_type == InputScriptType.SPENDADDRESS: # p2pkh
|
||||||
return node.address(coin.address_type)
|
return node.address(coin.address_type)
|
||||||
|
|
|
@ -17,8 +17,6 @@ pytest \
|
||||||
--ignore test_msg_ethereum_signmessage.py \
|
--ignore test_msg_ethereum_signmessage.py \
|
||||||
--ignore test_msg_ethereum_signtx.py \
|
--ignore test_msg_ethereum_signtx.py \
|
||||||
--ignore test_msg_ethereum_verifymessage.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_getaddress_show.py \
|
||||||
--ignore test_msg_loaddevice_xprv.py \
|
--ignore test_msg_loaddevice_xprv.py \
|
||||||
--ignore test_msg_nem_getaddress.py \
|
--ignore test_msg_nem_getaddress.py \
|
||||||
|
|
Loading…
Reference in New Issue