mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-27 15:31:31 +00:00
bitbox02: don't run show_xpub on GUI thread
This commit is contained in:
parent
0268b63fcb
commit
ffe3cef21a
2 changed files with 11 additions and 5 deletions
|
@ -196,7 +196,7 @@ class BitBox02Client(HardwareClientBase):
|
||||||
node = bip32.BIP32Node.from_xkey(xpub, net = constants.BitcoinMainnet()).subkey_at_public_derivation(())
|
node = bip32.BIP32Node.from_xkey(xpub, net = constants.BitcoinMainnet()).subkey_at_public_derivation(())
|
||||||
return node.eckey.get_public_key_bytes(compressed=True).hex()
|
return node.eckey.get_public_key_bytes(compressed=True).hex()
|
||||||
|
|
||||||
def get_xpub(self, bip32_path: str, xtype: str, display: bool = False) -> str:
|
def get_xpub(self, bip32_path: str, xtype: str, *, display: bool = False) -> str:
|
||||||
if self.bitbox02_device is None:
|
if self.bitbox02_device is None:
|
||||||
self.pairing_dialog(wizard=False)
|
self.pairing_dialog(wizard=False)
|
||||||
|
|
||||||
|
@ -612,3 +612,10 @@ class BitBox02Plugin(HW_PluginBase):
|
||||||
txin_type = wallet.get_txin_type(address)
|
txin_type = wallet.get_txin_type(address)
|
||||||
sequence = wallet.get_address_index(address)
|
sequence = wallet.get_address_index(address)
|
||||||
keystore.show_address(sequence, txin_type, wallet)
|
keystore.show_address(sequence, txin_type, wallet)
|
||||||
|
|
||||||
|
def show_xpub(self, keystore: BitBox02_KeyStore):
|
||||||
|
client = keystore.get_client()
|
||||||
|
assert isinstance(client, BitBox02Client)
|
||||||
|
derivation = keystore.get_derivation_prefix()
|
||||||
|
xtype = keystore.get_bip32_node_for_xpub().xtype
|
||||||
|
client.get_xpub(derivation, xtype, display=True)
|
||||||
|
|
|
@ -28,7 +28,6 @@ from electrum.i18n import _
|
||||||
from electrum.plugin import hook
|
from electrum.plugin import hook
|
||||||
from electrum.wallet import Multisig_Wallet
|
from electrum.wallet import Multisig_Wallet
|
||||||
from electrum.transaction import PartialTransaction
|
from electrum.transaction import PartialTransaction
|
||||||
from electrum import keystore
|
|
||||||
|
|
||||||
from .bitbox02 import BitBox02Plugin
|
from .bitbox02 import BitBox02Plugin
|
||||||
from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
|
from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
|
||||||
|
@ -77,11 +76,11 @@ class Plugin(BitBox02Plugin, QtPluginBase):
|
||||||
selected_keystore_index = labels_clayout.selected_index()
|
selected_keystore_index = labels_clayout.selected_index()
|
||||||
keystores = wallet.get_keystores()
|
keystores = wallet.get_keystores()
|
||||||
selected_keystore = keystores[selected_keystore_index]
|
selected_keystore = keystores[selected_keystore_index]
|
||||||
derivation = selected_keystore.get_derivation_prefix()
|
|
||||||
if type(selected_keystore) != self.keystore_class:
|
if type(selected_keystore) != self.keystore_class:
|
||||||
main_window.show_error("Select a BitBox02 xpub")
|
main_window.show_error("Select a BitBox02 xpub")
|
||||||
selected_keystore.get_client().get_xpub(
|
return
|
||||||
derivation, keystore.xtype_from_derivation(derivation), True
|
selected_keystore.thread.add(
|
||||||
|
partial(self.show_xpub, keystore=selected_keystore)
|
||||||
)
|
)
|
||||||
|
|
||||||
btn.clicked.connect(lambda unused: on_button_click())
|
btn.clicked.connect(lambda unused: on_button_click())
|
||||||
|
|
Loading…
Add table
Reference in a new issue