hardware wallets: pass xtype to get_xpub
This commit is contained in:
@@ -241,7 +241,8 @@ class BaseWizard(object):
|
||||
|
||||
def on_hw_derivation(self, name, device_info, derivation):
|
||||
from .keystore import hardware_keystore
|
||||
xpub = self.plugin.get_xpub(device_info.device.id_, derivation, self)
|
||||
xtype = 'p2wpkh-p2sh' if derivation.startswith("m/49'/") else 'standard'
|
||||
xpub = self.plugin.get_xpub(device_info.device.id_, derivation, xtype, self)
|
||||
if xpub is None:
|
||||
self.show_error('Cannot read xpub from device')
|
||||
return
|
||||
|
||||
@@ -927,7 +927,6 @@ def deserialize_xkey(xkey, prv):
|
||||
def deserialize_xpub(xkey):
|
||||
return deserialize_xkey(xkey, False)
|
||||
|
||||
|
||||
def deserialize_xprv(xkey):
|
||||
return deserialize_xkey(xkey, True)
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import threading
|
||||
from .util import *
|
||||
from .i18n import _
|
||||
from .util import profiler, PrintError, DaemonThread, UserCancelled, ThreadJob
|
||||
from . import bitcoin
|
||||
|
||||
plugin_loaders = {}
|
||||
hook_names = set()
|
||||
@@ -421,14 +422,14 @@ class DeviceMgr(ThreadJob, PrintError):
|
||||
def force_pair_xpub(self, plugin, handler, info, xpub, derivation, devices):
|
||||
# The wallet has not been previously paired, so let the user
|
||||
# choose an unpaired device and compare its first address.
|
||||
|
||||
xtype = bitcoin.xpub_type(xpub)
|
||||
client = self.client_lookup(info.device.id_)
|
||||
if client and client.is_pairable():
|
||||
# See comment above for same code
|
||||
client.handler = handler
|
||||
# This will trigger a PIN/passphrase entry request
|
||||
try:
|
||||
client_xpub = client.get_xpub(derivation)
|
||||
client_xpub = client.get_xpub(derivation, xtype)
|
||||
except (UserCancelled, RuntimeError):
|
||||
# Bad / cancelled PIN / passphrase
|
||||
client_xpub = None
|
||||
|
||||
@@ -1673,7 +1673,7 @@ class Simple_Deterministic_Wallet(Simple_Wallet, Deterministic_Wallet):
|
||||
def load_keystore(self):
|
||||
self.keystore = load_keystore(self.storage, 'keystore')
|
||||
try:
|
||||
xtype = deserialize_xpub(self.keystore.xpub)[0]
|
||||
xtype = bitcoin.xpub_type(self.keystore.xpub)
|
||||
except:
|
||||
xtype = 'standard'
|
||||
self.txin_type = 'p2pkh' if xtype == 'standard' else xtype
|
||||
@@ -1737,7 +1737,7 @@ class Multisig_Wallet(Deterministic_Wallet):
|
||||
name = 'x%d/'%(i+1)
|
||||
self.keystores[name] = load_keystore(self.storage, name)
|
||||
self.keystore = self.keystores['x1/']
|
||||
xtype = deserialize_xpub(self.keystore.xpub)[0]
|
||||
xtype = bitcoin.xpub_type(self.keystore.xpub)
|
||||
self.txin_type = 'p2sh' if xtype == 'standard' else xtype
|
||||
|
||||
def save_keystore(self):
|
||||
|
||||
Reference in New Issue
Block a user