Page MenuHomePhabricator

[electrum] fix imports in digitalbitbox
ClosedPublic

Authored by PiRK on Wed, Jun 19, 15:41.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC0f5f33a17f15: [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.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable