tMerge pull request #6386 from benma/bitbox02_id - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit cdda1549e91421723c677d751616660db95afb40 DIR parent 73cf007048b4f9381814d065c60999eda70e158c HTML Author: ghost43 <somber.night@protonmail.com> Date: Thu, 23 Jul 2020 00:15:26 +0000 Merge pull request #6386 from benma/bitbox02_id bitbox02: implement get_soft_device_id so multisig runs more smoothly Diffstat: M electrum/plugins/bitbox02/bitbox02… | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) --- DIR diff --git a/electrum/plugins/bitbox02/bitbox02.py b/electrum/plugins/bitbox02/bitbox02.py t@@ -85,7 +85,16 @@ class BitBox02Client(HardwareClientBase): return False return True - def pairing_dialog(self, wizard: bool = True): + def get_soft_device_id(self) -> Optional[str]: + if self.handler is None: + # Can't do the pairing without the handler. This happens at wallet creation time, when + # listing the devices. + return None + if self.bitbox02_device is None: + self.pairing_dialog() + return self.bitbox02_device.root_fingerprint().hex() + + def pairing_dialog(self): def pairing_step(code: str, device_response: Callable[[], bool]) -> bool: msg = "Please compare and confirm the pairing code on your BitBox02:\n" + code self.handler.show_message(msg) t@@ -197,7 +206,7 @@ class BitBox02Client(HardwareClientBase): def get_xpub(self, bip32_path: str, xtype: str, *, display: bool = False) -> str: if self.bitbox02_device is None: - self.pairing_dialog(wizard=False) + self.pairing_dialog() if self.bitbox02_device is None: raise Exception( t@@ -235,6 +244,20 @@ class BitBox02Client(HardwareClientBase): display=display, ) + def label(self) -> str: + if self.handler is None: + # Can't do the pairing without the handler. This happens at wallet creation time, when + # listing the devices. + return super().label() + if self.bitbox02_device is None: + self.pairing_dialog() + # We add the fingerprint to the label, as if there are two devices with the same label, the + # device manager can mistake one for another and fail. + return "%s (%s)" % ( + self.bitbox02_device.device_info()["name"], + self.bitbox02_device.root_fingerprint().hex(), + ) + def request_root_fingerprint_from_device(self) -> str: if self.bitbox02_device is None: raise Exception(