You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.9 KiB
85 lines
2.9 KiB
6 years ago
|
# This file is part of the Trezor project.
|
||
7 years ago
|
#
|
||
6 years ago
|
# Copyright (C) 2012-2018 SatoshiLabs and contributors
|
||
7 years ago
|
#
|
||
|
# This library is free software: you can redistribute it and/or modify
|
||
6 years ago
|
# it under the terms of the GNU Lesser General Public License version 3
|
||
|
# as published by the Free Software Foundation.
|
||
7 years ago
|
#
|
||
|
# This library is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU Lesser General Public License for more details.
|
||
|
#
|
||
6 years ago
|
# You should have received a copy of the License along with this library.
|
||
|
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||
7 years ago
|
|
||
6 years ago
|
from trezorlib import btc, messages as proto
|
||
|
|
||
6 years ago
|
from ..support import ckd_public as bip32
|
||
6 years ago
|
from .common import TrezorTest
|
||
7 years ago
|
|
||
10 years ago
|
|
||
6 years ago
|
class TestMsgGetaddressShow(TrezorTest):
|
||
10 years ago
|
def test_show(self):
|
||
|
self.setup_mnemonic_nopin_nopassphrase()
|
||
6 years ago
|
assert (
|
||
|
btc.get_address(self.client, "Bitcoin", [1], show_display=True)
|
||
|
== "1CK7SJdcb8z9HuvVft3D91HLpLC6KSsGb"
|
||
|
)
|
||
|
assert (
|
||
|
btc.get_address(self.client, "Bitcoin", [2], show_display=True)
|
||
|
== "15AeAhtNJNKyowK8qPHwgpXkhsokzLtUpG"
|
||
|
)
|
||
|
assert (
|
||
|
btc.get_address(self.client, "Bitcoin", [3], show_display=True)
|
||
|
== "1CmzyJp9w3NafXMSEFH4SLYUPAVCSUrrJ5"
|
||
|
)
|
||
10 years ago
|
|
||
10 years ago
|
def test_show_multisig_3(self):
|
||
10 years ago
|
self.setup_mnemonic_nopin_nopassphrase()
|
||
|
|
||
6 years ago
|
node = bip32.deserialize(
|
||
|
"xpub661MyMwAqRbcF1zGijBb2K6x9YiJPh58xpcCeLvTxMX6spkY3PcpJ4ABcCyWfskq5DDxM3e6Ez5ePCqG5bnPUXR4wL8TZWyoDaUdiWW7bKy"
|
||
|
)
|
||
7 years ago
|
multisig = proto.MultisigRedeemScriptType(
|
||
7 years ago
|
pubkeys=[
|
||
7 years ago
|
proto.HDNodePathType(node=node, address_n=[1]),
|
||
|
proto.HDNodePathType(node=node, address_n=[2]),
|
||
6 years ago
|
proto.HDNodePathType(node=node, address_n=[3]),
|
||
7 years ago
|
],
|
||
6 years ago
|
signatures=[b"", b"", b""],
|
||
7 years ago
|
m=2,
|
||
|
)
|
||
10 years ago
|
|
||
10 years ago
|
for i in [1, 2, 3]:
|
||
6 years ago
|
assert (
|
||
|
btc.get_address(
|
||
|
self.client, "Bitcoin", [i], show_display=True, multisig=multisig
|
||
|
)
|
||
|
== "3E7GDtuHqnqPmDgwH59pVC7AvySiSkbibz"
|
||
|
)
|
||
10 years ago
|
|
||
|
def test_show_multisig_15(self):
|
||
|
self.setup_mnemonic_nopin_nopassphrase()
|
||
|
|
||
6 years ago
|
node = bip32.deserialize(
|
||
|
"xpub661MyMwAqRbcF1zGijBb2K6x9YiJPh58xpcCeLvTxMX6spkY3PcpJ4ABcCyWfskq5DDxM3e6Ez5ePCqG5bnPUXR4wL8TZWyoDaUdiWW7bKy"
|
||
|
)
|
||
10 years ago
|
|
||
|
pubs = []
|
||
|
for x in range(15):
|
||
7 years ago
|
pubs.append(proto.HDNodePathType(node=node, address_n=[x]))
|
||
10 years ago
|
|
||
7 years ago
|
multisig = proto.MultisigRedeemScriptType(
|
||
6 years ago
|
pubkeys=pubs, signatures=[b""] * 15, m=15
|
||
7 years ago
|
)
|
||
10 years ago
|
|
||
|
for i in range(15):
|
||
6 years ago
|
assert (
|
||
|
btc.get_address(
|
||
|
self.client, "Bitcoin", [i], show_display=True, multisig=multisig
|
||
|
)
|
||
|
== "3QaKF8zobqcqY8aS6nxCD5ZYdiRfL3RCmU"
|
||
|
)
|