diff --git a/tests/device_tests/test_msg_getaddress.py b/tests/device_tests/test_msg_getaddress.py index 403e1fa9b..374bdf545 100644 --- a/tests/device_tests/test_msg_getaddress.py +++ b/tests/device_tests/test_msg_getaddress.py @@ -16,10 +16,9 @@ import pytest -from trezorlib import btc, messages as proto +from trezorlib import btc, ckd_public as bip32, messages as proto from trezorlib.tools import H_, CallException, parse_path -from ..support import ckd_public as bip32 from .common import TrezorTest diff --git a/tests/device_tests/test_msg_getaddress_segwit.py b/tests/device_tests/test_msg_getaddress_segwit.py index f53e268eb..7a1d5a41a 100644 --- a/tests/device_tests/test_msg_getaddress_segwit.py +++ b/tests/device_tests/test_msg_getaddress_segwit.py @@ -17,7 +17,6 @@ from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from ..support import ckd_public as bip32 from .common import TrezorTest @@ -82,17 +81,13 @@ class TestMsgGetaddressSegwit(TrezorTest): def test_show_multisig_3(self): self.setup_mnemonic_allallall() - nodes = map( - lambda index: btc.get_public_node( - self.client, parse_path("999'/1'/%d'" % index) - ), - range(1, 4), - ) + nodes = [ + btc.get_public_node(self.client, parse_path("999'/1'/%d'" % i)).node + for i in range(1, 4) + ] + multisig1 = proto.MultisigRedeemScriptType( - nodes=[bip32.deserialize(n.xpub) for n in nodes], - address_n=[2, 0], - signatures=[b"", b"", b""], - m=2, + nodes=nodes, address_n=[2, 0], signatures=[b"", b"", b""], m=2 ) # multisig2 = proto.MultisigRedeemScriptType( # pubkeys=map(lambda n: proto.HDNodePathType(node=bip32.deserialize(n.xpub), address_n=[2, 1]), nodes), diff --git a/tests/device_tests/test_msg_getaddress_segwit_native.py b/tests/device_tests/test_msg_getaddress_segwit_native.py index a287f75f4..73a68d10d 100644 --- a/tests/device_tests/test_msg_getaddress_segwit_native.py +++ b/tests/device_tests/test_msg_getaddress_segwit_native.py @@ -17,7 +17,6 @@ from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from ..support import ckd_public as bip32 from .common import TrezorTest @@ -83,20 +82,14 @@ class TestMsgGetaddressSegwitNative(TrezorTest): def test_show_multisig_3(self): self.setup_mnemonic_allallall() nodes = [ - btc.get_public_node(self.client, parse_path("999'/1'/%d'" % index)) + btc.get_public_node(self.client, parse_path("999'/1'/%d'" % index)).node for index in range(1, 4) ] multisig1 = proto.MultisigRedeemScriptType( - nodes=[bip32.deserialize(n.xpub) for n in nodes], - address_n=[2, 0], - signatures=[b"", b"", b""], - m=2, + nodes=nodes, address_n=[2, 0], signatures=[b"", b"", b""], m=2 ) multisig2 = proto.MultisigRedeemScriptType( - nodes=[bip32.deserialize(n.xpub) for n in nodes], - address_n=[2, 1], - signatures=[b"", b"", b""], - m=2, + nodes=nodes, address_n=[2, 1], signatures=[b"", b"", b""], m=2 ) for i in [1, 2, 3]: assert ( diff --git a/tests/device_tests/test_msg_getaddress_show.py b/tests/device_tests/test_msg_getaddress_show.py index 5f3a0391b..55234e8e0 100644 --- a/tests/device_tests/test_msg_getaddress_show.py +++ b/tests/device_tests/test_msg_getaddress_show.py @@ -14,9 +14,8 @@ # You should have received a copy of the License along with this library. # If not, see . -from trezorlib import btc, messages as proto +from trezorlib import btc, ckd_public as bip32, messages as proto -from ..support import ckd_public as bip32 from .common import TrezorTest diff --git a/tests/device_tests/test_msg_getpublickey.py b/tests/device_tests/test_msg_getpublickey.py index a3c42605d..cc5236b8e 100644 --- a/tests/device_tests/test_msg_getpublickey.py +++ b/tests/device_tests/test_msg_getpublickey.py @@ -14,10 +14,9 @@ # You should have received a copy of the License along with this library. # If not, see . -from trezorlib import btc, messages as proto +from trezorlib import btc, ckd_public as bip32, messages as proto from trezorlib.tools import H_ -from ..support import ckd_public as bip32 from .common import TrezorTest diff --git a/tests/device_tests/test_msg_signtx_bcash.py b/tests/device_tests/test_msg_signtx_bcash.py index 892efa2a7..54a6cc014 100644 --- a/tests/device_tests/test_msg_signtx_bcash.py +++ b/tests/device_tests/test_msg_signtx_bcash.py @@ -19,7 +19,6 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import H_, CallException, parse_path -from ..support.ckd_public import deserialize from .common import TrezorTest from .tx_cache import tx_cache @@ -413,21 +412,14 @@ class TestMsgSigntxBch(TrezorTest): def test_send_bch_multisig_wrongchange(self): self.setup_mnemonic_allallall() - xpubs = [] - for n in map( - lambda index: btc.get_public_node( - self.client, parse_path("48'/145'/%d'" % index) - ), - range(1, 4), - ): - xpubs.append(n.xpub) + nodes = [ + btc.get_public_node(self.client, parse_path("48'/145'/%d'" % i)).node + for i in range(1, 4) + ] - def getmultisig(chain, nr, signatures=[b"", b"", b""], xpubs=xpubs): + def getmultisig(chain, nr, signatures=[b"", b"", b""], nodes=nodes): return proto.MultisigRedeemScriptType( - nodes=[deserialize(xpub) for xpub in xpubs], - address_n=[chain, nr], - signatures=signatures, - m=2, + nodes=nodes, address_n=[chain, nr], signatures=signatures, m=2 ) correcthorse = proto.HDNodeType( @@ -459,7 +451,7 @@ class TestMsgSigntxBch(TrezorTest): address_n=parse_path("48'/145'/1'/1/1"), multisig=proto.MultisigRedeemScriptType( pubkeys=[ - proto.HDNodePathType(node=deserialize(xpubs[0]), address_n=[1, 1]), + proto.HDNodePathType(node=nodes[0], address_n=[1, 1]), proto.HDNodePathType(node=correcthorse, address_n=[]), proto.HDNodePathType(node=correcthorse, address_n=[]), ], @@ -507,21 +499,14 @@ class TestMsgSigntxBch(TrezorTest): def test_send_bch_multisig_change(self): self.setup_mnemonic_allallall() - xpubs = [] - for n in map( - lambda index: btc.get_public_node( - self.client, parse_path("48'/145'/%d'" % index) - ), - range(1, 4), - ): - xpubs.append(n.xpub) + nodes = [ + btc.get_public_node(self.client, parse_path("48'/145'/%d'" % i)).node + for i in range(1, 4) + ] - def getmultisig(chain, nr, signatures=[b"", b"", b""], xpubs=xpubs): + def getmultisig(chain, nr, signatures=[b"", b"", b""], nodes=nodes): return proto.MultisigRedeemScriptType( - nodes=[deserialize(xpub) for xpub in xpubs], - address_n=[chain, nr], - signatures=signatures, - m=2, + nodes=nodes, address_n=[chain, nr], signatures=signatures, m=2 ) inp1 = proto.TxInputType( diff --git a/tests/device_tests/test_msg_signtx_bgold.py b/tests/device_tests/test_msg_signtx_bgold.py index 9a24c572e..f71de155a 100644 --- a/tests/device_tests/test_msg_signtx_bgold.py +++ b/tests/device_tests/test_msg_signtx_bgold.py @@ -19,7 +19,6 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import H_, CallException, parse_path -from ..support.ckd_public import deserialize from .common import TrezorTest from .tx_cache import tx_cache @@ -224,21 +223,14 @@ class TestMsgSigntxBitcoinGold(TrezorTest): def test_send_btg_multisig_change(self): self.setup_mnemonic_allallall() - xpubs = [] - for n in map( - lambda index: btc.get_public_node( - self.client, parse_path("48'/156'/%d'" % index) - ), - range(1, 4), - ): - xpubs.append(n.xpub) + nodes = [ + btc.get_public_node(self.client, parse_path("48'/156'/%d'" % i)).node + for i in range(1, 4) + ] - def getmultisig(chain, nr, signatures=[b"", b"", b""], xpubs=xpubs): + def getmultisig(chain, nr, signatures=[b"", b"", b""], nodes=nodes): return proto.MultisigRedeemScriptType( - nodes=[deserialize(xpub) for xpub in xpubs], - address_n=[chain, nr], - signatures=signatures, - m=2, + nodes=nodes, address_n=[chain, nr], signatures=signatures, m=2 ) inp1 = proto.TxInputType( @@ -496,17 +488,12 @@ class TestMsgSigntxBitcoinGold(TrezorTest): def test_send_multisig_1(self): self.setup_mnemonic_allallall() - nodes = map( - lambda index: btc.get_public_node( - self.client, parse_path("49'/156'/%d'" % index) - ), - range(1, 4), - ) + nodes = [ + btc.get_public_node(self.client, parse_path("49'/156'/%d'" % i)).node + for i in range(1, 4) + ] multisig = proto.MultisigRedeemScriptType( - nodes=[deserialize(n.xpub) for n in nodes], - address_n=[1, 0], - signatures=[b"", b"", b""], - m=2, + nodes=nodes, address_n=[1, 0], signatures=[b"", b"", b""], m=2 ) inp1 = proto.TxInputType( diff --git a/tests/device_tests/test_msg_signtx_segwit.py b/tests/device_tests/test_msg_signtx_segwit.py index 080cf9e48..7c18821e8 100644 --- a/tests/device_tests/test_msg_signtx_segwit.py +++ b/tests/device_tests/test_msg_signtx_segwit.py @@ -19,7 +19,6 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import H_, CallException, parse_path -from ..support.ckd_public import deserialize from .common import TrezorTest from .conftest import TREZOR_VERSION from .tx_cache import tx_cache @@ -216,17 +215,13 @@ class TestMsgSigntxSegwit(TrezorTest): def test_send_multisig_1(self): self.setup_mnemonic_allallall() - nodes = map( - lambda index: btc.get_public_node( - self.client, parse_path("49'/1'/%d'" % index) - ), - range(1, 4), - ) + nodes = [ + btc.get_public_node(self.client, parse_path("49'/1'/%d'" % i)).node + for i in range(1, 4) + ] + multisig = proto.MultisigRedeemScriptType( - nodes=[deserialize(n.xpub) for n in nodes], - address_n=[1, 0], - signatures=[b"", b"", b""], - m=2, + nodes=nodes, address_n=[1, 0], signatures=[b"", b"", b""], m=2 ) inp1 = proto.TxInputType( diff --git a/tests/device_tests/test_msg_signtx_segwit_native.py b/tests/device_tests/test_msg_signtx_segwit_native.py index f7d9cd3d8..6bbd9a7d2 100644 --- a/tests/device_tests/test_msg_signtx_segwit_native.py +++ b/tests/device_tests/test_msg_signtx_segwit_native.py @@ -15,9 +15,9 @@ # If not, see . from trezorlib import btc, messages as proto +from trezorlib.ckd_public import deserialize from trezorlib.tools import H_, parse_path -from ..support.ckd_public import deserialize from .common import TrezorTest from .tx_cache import tx_cache diff --git a/tests/device_tests/test_multisig.py b/tests/device_tests/test_multisig.py index 438b03fa2..2607f044f 100644 --- a/tests/device_tests/test_multisig.py +++ b/tests/device_tests/test_multisig.py @@ -16,11 +16,9 @@ import pytest -from trezorlib import btc, messages as proto +from trezorlib import btc, ckd_public as bip32, messages as proto from trezorlib.tools import CallException, parse_path -from ..support import ckd_public as bip32 -from ..support.ckd_public import deserialize from .common import TrezorTest from .tx_cache import tx_cache @@ -35,15 +33,12 @@ class TestMultisig(TrezorTest): def test_2_of_3(self): self.setup_mnemonic_allallall() nodes = [ - btc.get_public_node(self.client, parse_path("48'/0'/%d'" % index)) + btc.get_public_node(self.client, parse_path("48'/0'/%d'" % index)).node for index in range(1, 4) ] multisig = proto.MultisigRedeemScriptType( - nodes=[deserialize(n.xpub) for n in nodes], - address_n=[0, 0], - signatures=[b"", b"", b""], - m=2, + nodes=nodes, address_n=[0, 0], signatures=[b"", b"", b""], m=2 ) # Let's go to sign with key 1 inp1 = proto.TxInputType( @@ -125,7 +120,7 @@ class TestMultisig(TrezorTest): # Let's do second signature using 3rd key multisig = proto.MultisigRedeemScriptType( - nodes=[deserialize(n.xpub) for n in nodes], + nodes=nodes, address_n=[0, 0], signatures=[ signatures1[0], diff --git a/tests/device_tests/test_multisig_change.py b/tests/device_tests/test_multisig_change.py index 4f6ae7b0d..ca8e01733 100644 --- a/tests/device_tests/test_multisig_change.py +++ b/tests/device_tests/test_multisig_change.py @@ -14,10 +14,9 @@ # You should have received a copy of the License along with this library. # If not, see . -from trezorlib import btc, messages as proto +from trezorlib import btc, ckd_public as bip32, messages as proto from trezorlib.tools import H_, parse_path -from ..support import ckd_public as bip32 from .common import TrezorTest from .tx_cache import tx_cache