HomePhabricator

[electrum] fix imports in digitalbitbox

Description

[electrum] fix imports in digitalbitbox

Summary:
Wrapping all imports in a try: ... except ImportError: clause makes it very easy to break the plugin via internal refactoring without realizing it. If any import was broken the plugin would just silently fail to load and the devices would not be supported.

The only optional external library required by this plugin seems to be hidapi (is is installed via requirements-hw.txt, not the main requirements.txt file).

Depends on D16355

Test Plan:
Run the application with this patch:

diff --git a/electrum/electrumabc/base_wizard.py b/electrum/electrumabc/base_wizard.py
index 663cffff7d..8548b171be 100644
--- a/electrum/electrumabc/base_wizard.py
+++ b/electrum/electrumabc/base_wizard.py
@@ -310,6 +310,8 @@ class BaseWizard(PrintError):
         title = _("Hardware Keystore")
         # check available plugins
         support = self.plugins.get_hardware_support()
+        print(support)
+        print([s for s in support if not s[2].libraries_available])
         if not support:
             msg = "\n".join(
                 [

Launch the "new wallet" creation wizard, pick "Standard wallet", then "Hardware device", and when clicking next check that the second list printed to the terminal is empty, and Digitalbitbox is in the first list.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D16356

Details

Provenance
PiRKAuthored on Jun 19 2024, 15:29
PiRKPushed on Jun 20 2024, 10:19
Reviewer
Restricted Project
Differential Revision
D16356: [electrum] fix imports in digitalbitbox
Parents
rABC2065f00accec: [electrum] move pubkey_from_signature -> ECPubkey.from_signature65
Branches
Unknown
Tags
Unknown