What changed, and why it matters
This is a small internal code cleanup. A function that registers command names is changed so callers explicitly provide the name, rather than the function deriving it from the function's own name. The commit message says this lets plugins reuse existing command names without triggering a false 'name collision' error. There is no security fix here—just a refactor to avoid an overly strict uniqueness check.
No security action required. Treat as routine refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors AuthenticatedServer.register_method() to take an explicit ‘name’ string parameter instead of reading f.name. All internal callers are updated to pass the desired command name. The stated intent is to allow plugins to register methods under names that already exist in the command table without Electrum raising an assertion about collisions. No vulnerability is patched; the change relaxes a registration-time assertion by making it name-parameterized.
Changed components
electrum/daemon.pyelectrum/plugins/watchtower/server.pyInspect captured patch +9 / −9
diff --git a/electrum/daemon.py b/electrum/daemon.py
index 9114bab..3afa92a 100644
--- a/electrum/daemon.py
+++ b/electrum/daemon.py
@@ -214,9 +214,9 @@ class AuthenticatedServer(Logger):
self.auth_lock = asyncio.Lock()
self._methods = {} # type: Dict[str, Callable]
- def register_method(self, f):
- assert f.__name__ not in self._methods, f"name collision for {f.__name__}"
- self._methods[f.__name__] = f
+ def register_method(self, name: str, f):
+ assert name not in self._methods, f"name collision for {name}"
+ self._methods[name] = f
async def authenticate(self, headers):
if self.rpc_password == '':
@@ -299,12 +299,12 @@ class CommandsServer(AuthenticatedServer):
self.port = self.config.RPC_PORT
self.app = web.Application()
self.app.router.add_post("/", self.handle)
- self.register_method(self.ping)
- self.register_method(self.gui)
+ self.register_method('ping', self.ping)
+ self.register_method('gui', self.gui)
self.cmd_runner = Commands(config=self.config, network=self.daemon.network, daemon=self.daemon)
for cmdname in known_commands:
- self.register_method(getattr(self.cmd_runner, cmdname))
- self.register_method(self.run_cmdline)
+ self.register_method(cmdname, getattr(self.cmd_runner, cmdname))
+ self.register_method('run_cmdline', self.run_cmdline)
def _socket_config_str(self) -> str:
if self.socktype == 'unix':
diff --git a/electrum/plugins/watchtower/server.py b/electrum/plugins/watchtower/server.py
index 172a0bf..e184753 100644
--- a/electrum/plugins/watchtower/server.py
+++ b/electrum/plugins/watchtower/server.py
@@ -28,8 +28,8 @@ class WatchTowerServer(AuthenticatedServer):
self.lnwatcher = watchtower
self.app = web.Application()
self.app.router.add_post("/", self.handle)
- self.register_method(self.get_ctn)
- self.register_method(self.add_sweep_tx)
+ self.register_method('get_ctn', self.get_ctn)
+ self.register_method('add_sweep_tx', self.add_sweep_tx)
async def run(self):
self.runner = web.AppRunner(self.app)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.