From 106688ea541a746bc7d9c5c833937d50ee4c0ce7 Mon Sep 17 00:00:00 2001 From: Marko Bencun Date: Tue, 14 Jul 2020 16:44:29 +0200 Subject: [PATCH] bitbox02: implement get_soft_device_id so multisig runs more smoothly Without it, if you have say a 1-of-2 multisig with two BitBox02s, you would run into trouble if the first keystore would try to match to the wrong inserted BitBox02 (wrong order, or the first one is not inserted, etc. ). With the soft device id, the device manager can figure it on its own which keystore belongs to which connected bb02. --- electrum/plugins/bitbox02/bitbox02.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/electrum/plugins/bitbox02/bitbox02.py b/electrum/plugins/bitbox02/bitbox02.py index a0a36ff05..339604127 100644 --- a/electrum/plugins/bitbox02/bitbox02.py +++ b/electrum/plugins/bitbox02/bitbox02.py @@ -85,6 +85,15 @@ class BitBox02Client(HardwareClientBase): return False return 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(wizard=False) + return self.bitbox02_device.root_fingerprint().hex() + def pairing_dialog(self, wizard: bool = True): def pairing_step(code: str, device_response: Callable[[], bool]) -> bool: msg = "Please compare and confirm the pairing code on your BitBox02:\n" + code