Browse Source

bitbox02: more robust account keypath

In multisig, we plan to allow other kinds of keypaths that are not
exactly 4 elements long. This change allows parsing the account
keypath for any kind of keypath, assuming the last two element are /change/address.
patch-4
Marko Bencun 4 years ago
parent
commit
b78b077606
No known key found for this signature in database GPG Key ID: 804538928C37EAE8
  1. 13
      electrum/plugins/bitbox02/bitbox02.py

13
electrum/plugins/bitbox02/bitbox02.py

@ -293,8 +293,7 @@ class BitBox02Client(HardwareClientBase):
raise Exception( raise Exception(
"Need to setup communication first before attempting any BitBox02 calls" "Need to setup communication first before attempting any BitBox02 calls"
) )
account_keypath = bip32_path[:-2]
account_keypath = bip32_path[:4]
xpubs = wallet.get_master_public_keys() xpubs = wallet.get_master_public_keys()
our_xpub = self.get_xpub( our_xpub = self.get_xpub(
bip32.convert_bip32_intpath_to_strpath(account_keypath), xtype bip32.convert_bip32_intpath_to_strpath(account_keypath), xtype
@ -504,15 +503,7 @@ class BitBox02Client(HardwareClientBase):
) )
) )
if type(wallet) is Standard_Wallet: keypath_account = full_path[:-2]
keypath_account = full_path[:3]
elif type(wallet) is Multisig_Wallet:
keypath_account = full_path[:4]
else:
raise Exception(
"BitBox02 does not support this wallet type: {}".format(type(wallet))
)
sigs = self.bitbox02_device.btc_sign( sigs = self.bitbox02_device.btc_sign(
coin, coin,
[bitbox02.btc.BTCScriptConfigWithKeypath( [bitbox02.btc.BTCScriptConfigWithKeypath(

Loading…
Cancel
Save