Skip to content

Commit 57eb3f3

Browse files
JLMoriartclaude
andauthored
Fix repeated device enumeration in hardware wallet wizard (Electron-Cash#3192)
choose_hw_device() called unpaired_device_infos() per plugin, and each call triggered a full scan_devices() across all plugins — creating N² enumeration calls. Now scan_devices() is called once before the loop and the cached result is passed via the existing devices= parameter. Co-authored-by: John Moriarty <JLMoriart@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a51bee2 commit 57eb3f3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

electroncash/base_wizard.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,14 @@ def choose_hw_device(self):
222222
title = _('Hardware Keystore')
223223
# check available plugins
224224
support = self.plugins.get_hardware_support()
225-
# scan devices
225+
# scan devices once upfront (not per-plugin) to avoid repeated enumeration
226226
devices = []
227227
devmgr = self.plugins.device_manager
228+
scanned = devmgr.scan_devices()
228229
for name, description, plugin in support:
229230
try:
230231
# FIXME: side-effect: unpaired_device_info sets client.handler
231-
u = devmgr.unpaired_device_infos(None, plugin)
232+
u = devmgr.unpaired_device_infos(None, plugin, devices=scanned)
232233
except:
233234
devmgr.print_exception("error", name)
234235
continue

0 commit comments

Comments
 (0)