|
|
|
@ -20,81 +20,66 @@ from trezorlib import btc, messages as proto
|
|
|
|
|
from trezorlib.exceptions import TrezorFailure
|
|
|
|
|
from trezorlib.tools import parse_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestMsgGetaddressSegwitNative:
|
|
|
|
|
def test_show_segwit(self, client):
|
|
|
|
|
assert (
|
|
|
|
|
btc.get_address(
|
|
|
|
|
client,
|
|
|
|
|
"Testnet",
|
|
|
|
|
parse_path("84'/1'/0'/0/0"),
|
|
|
|
|
True,
|
|
|
|
|
None,
|
|
|
|
|
script_type=proto.InputScriptType.SPENDWITNESS,
|
|
|
|
|
)
|
|
|
|
|
== "tb1qkvwu9g3k2pdxewfqr7syz89r3gj557l3uuf9r9"
|
|
|
|
|
)
|
|
|
|
|
assert (
|
|
|
|
|
btc.get_address(
|
|
|
|
|
client,
|
|
|
|
|
"Testnet",
|
|
|
|
|
parse_path("84'/1'/0'/1/0"),
|
|
|
|
|
False,
|
|
|
|
|
None,
|
|
|
|
|
script_type=proto.InputScriptType.SPENDWITNESS,
|
|
|
|
|
)
|
|
|
|
|
== "tb1qejqxwzfld7zr6mf7ygqy5s5se5xq7vmt96jk9x"
|
|
|
|
|
)
|
|
|
|
|
assert (
|
|
|
|
|
btc.get_address(
|
|
|
|
|
client,
|
|
|
|
|
VECTORS = ( # coin, path, script_type, address
|
|
|
|
|
(
|
|
|
|
|
"Testnet",
|
|
|
|
|
parse_path("84'/1'/0'/0/0"),
|
|
|
|
|
False,
|
|
|
|
|
None,
|
|
|
|
|
script_type=proto.InputScriptType.SPENDWITNESS,
|
|
|
|
|
)
|
|
|
|
|
== "tb1qkvwu9g3k2pdxewfqr7syz89r3gj557l3uuf9r9"
|
|
|
|
|
)
|
|
|
|
|
assert (
|
|
|
|
|
btc.get_address(
|
|
|
|
|
client,
|
|
|
|
|
"84'/1'/0'/0/0",
|
|
|
|
|
proto.InputScriptType.SPENDWITNESS,
|
|
|
|
|
"tb1qkvwu9g3k2pdxewfqr7syz89r3gj557l3uuf9r9",
|
|
|
|
|
),
|
|
|
|
|
(
|
|
|
|
|
"Testnet",
|
|
|
|
|
parse_path("44'/1'/0'/0/0"),
|
|
|
|
|
False,
|
|
|
|
|
None,
|
|
|
|
|
script_type=proto.InputScriptType.SPENDADDRESS,
|
|
|
|
|
)
|
|
|
|
|
== "mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@pytest.mark.altcoin
|
|
|
|
|
def test_show_segwit_altcoin(self, client):
|
|
|
|
|
assert (
|
|
|
|
|
btc.get_address(
|
|
|
|
|
client,
|
|
|
|
|
"84'/1'/0'/1/0",
|
|
|
|
|
proto.InputScriptType.SPENDWITNESS,
|
|
|
|
|
"tb1qejqxwzfld7zr6mf7ygqy5s5se5xq7vmt96jk9x",
|
|
|
|
|
),
|
|
|
|
|
(
|
|
|
|
|
"Bitcoin",
|
|
|
|
|
"84'/0'/0'/0/0",
|
|
|
|
|
proto.InputScriptType.SPENDWITNESS,
|
|
|
|
|
"bc1qannfxke2tfd4l7vhepehpvt05y83v3qsf6nfkk",
|
|
|
|
|
),
|
|
|
|
|
(
|
|
|
|
|
"Bitcoin",
|
|
|
|
|
"84'/0'/0'/1/0",
|
|
|
|
|
proto.InputScriptType.SPENDWITNESS,
|
|
|
|
|
"bc1qktmhrsmsenepnnfst8x6j27l0uqv7ggrg8x38q",
|
|
|
|
|
),
|
|
|
|
|
pytest.param(
|
|
|
|
|
"Groestlcoin",
|
|
|
|
|
parse_path("84'/17'/0'/0/0"),
|
|
|
|
|
False,
|
|
|
|
|
None,
|
|
|
|
|
script_type=proto.InputScriptType.SPENDWITNESS,
|
|
|
|
|
)
|
|
|
|
|
== "grs1qw4teyraux2s77nhjdwh9ar8rl9dt7zww8r6lne"
|
|
|
|
|
)
|
|
|
|
|
"84'/17'/0'/0/0",
|
|
|
|
|
proto.InputScriptType.SPENDWITNESS,
|
|
|
|
|
"grs1qw4teyraux2s77nhjdwh9ar8rl9dt7zww8r6lne",
|
|
|
|
|
marks=pytest.mark.altcoin,
|
|
|
|
|
),
|
|
|
|
|
pytest.param(
|
|
|
|
|
"Elements",
|
|
|
|
|
"84'/1'/0'/0/0",
|
|
|
|
|
proto.InputScriptType.SPENDWITNESS,
|
|
|
|
|
"ert1qkvwu9g3k2pdxewfqr7syz89r3gj557l3xp9k2v",
|
|
|
|
|
marks=pytest.mark.altcoin,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("show_display", (True, False))
|
|
|
|
|
@pytest.mark.parametrize("coin, path, script_type, address", VECTORS)
|
|
|
|
|
def test_show_segwit(client, show_display, coin, path, script_type, address):
|
|
|
|
|
assert (
|
|
|
|
|
btc.get_address(
|
|
|
|
|
client,
|
|
|
|
|
"Elements",
|
|
|
|
|
parse_path("84'/1'/0'/0/0"),
|
|
|
|
|
False,
|
|
|
|
|
coin,
|
|
|
|
|
parse_path(path),
|
|
|
|
|
show_display,
|
|
|
|
|
None,
|
|
|
|
|
script_type=proto.InputScriptType.SPENDWITNESS,
|
|
|
|
|
script_type=script_type,
|
|
|
|
|
)
|
|
|
|
|
== "ert1qkvwu9g3k2pdxewfqr7syz89r3gj557l3xp9k2v"
|
|
|
|
|
== address
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@pytest.mark.multisig
|
|
|
|
|
def test_show_multisig_3(self, client):
|
|
|
|
|
|
|
|
|
|
@pytest.mark.multisig
|
|
|
|
|
def test_show_multisig_3(client):
|
|
|
|
|
nodes = [
|
|
|
|
|
btc.get_public_node(
|
|
|
|
|
client, parse_path("84'/1'/%d'" % index), coin_name="Testnet"
|
|
|
|
@ -131,9 +116,10 @@ class TestMsgGetaddressSegwitNative:
|
|
|
|
|
== "tb1qgvn67p4twmpqhs8c39tukmu9geamtf7x0z3flwf9rrw4ff3h6d2qt0czq3"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@pytest.mark.multisig
|
|
|
|
|
@pytest.mark.parametrize("show_display", (True, False))
|
|
|
|
|
def test_multisig_missing(self, client, show_display):
|
|
|
|
|
|
|
|
|
|
@pytest.mark.multisig
|
|
|
|
|
@pytest.mark.parametrize("show_display", (True, False))
|
|
|
|
|
def test_multisig_missing(client, show_display):
|
|
|
|
|
# Multisig with global suffix specification.
|
|
|
|
|
# Use account numbers 1, 2 and 3 to create a valid multisig,
|
|
|
|
|
# but not containing the keys from account 0 used below.
|
|
|
|
|