tests: fix reference to ckd_public

we aren't moving ckd_public out of trezorlib just yet. It will go away
in 0.12.

tests: move ckd_public

tests: remove useless usages of ckd_public
pull/404/head
matejcik 5 years ago committed by matejcik
parent 67b879ac07
commit 0312fb264b

@ -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

@ -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),

@ -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 (

@ -14,9 +14,8 @@
# 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>.
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

@ -14,10 +14,9 @@
# 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>.
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

@ -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(

@ -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(

@ -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(

@ -15,9 +15,9 @@
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
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

@ -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],

@ -14,10 +14,9 @@
# 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>.
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

Loading…
Cancel
Save