bip32: refactor whole module. clean-up.
This commit is contained in:
@@ -3,7 +3,7 @@ import sys
|
||||
|
||||
from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
|
||||
from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
|
||||
from electrum.bip32 import deserialize_xpub, convert_bip32_path_to_list_of_uint32 as parse_path
|
||||
from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path
|
||||
from electrum import constants
|
||||
from electrum.i18n import _
|
||||
from electrum.plugin import Device
|
||||
@@ -241,13 +241,13 @@ class TrezorPlugin(HW_PluginBase):
|
||||
raise RuntimeError("Unsupported recovery method")
|
||||
|
||||
def _make_node_path(self, xpub, address_n):
|
||||
_, depth, fingerprint, child_num, chain_code, key = deserialize_xpub(xpub)
|
||||
bip32node = BIP32Node.from_xkey(xpub)
|
||||
node = HDNodeType(
|
||||
depth=depth,
|
||||
fingerprint=int.from_bytes(fingerprint, 'big'),
|
||||
child_num=int.from_bytes(child_num, 'big'),
|
||||
chain_code=chain_code,
|
||||
public_key=key,
|
||||
depth=bip32node.depth,
|
||||
fingerprint=int.from_bytes(bip32node.fingerprint, 'big'),
|
||||
child_num=int.from_bytes(bip32node.child_number, 'big'),
|
||||
chain_code=bip32node.chaincode,
|
||||
public_key=bip32node.eckey.get_public_key_bytes(compressed=True),
|
||||
)
|
||||
return HDNodePathType(node=node, address_n=address_n)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user