From b9a24ae1cf6fd0505cb56c9ee683b134f7361359 Mon Sep 17 00:00:00 2001 From: f321x Date: Fri, 27 Mar 2026 15:05:15 +0100 Subject: [PATCH] plugin: nwc: handle missing params dict in request Even though the NIP-47 specification kind of defines that requests should always pass a params dict in their request i witnessed way too often that clients don't include it in some requests where it is technically not neccessary and we fail on it. Handling this gracefully improves compatibility without obvious downsides. --- electrum/plugins/nwc/nwcserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electrum/plugins/nwc/nwcserver.py b/electrum/plugins/nwc/nwcserver.py index 9e278d008..6d6df54e7 100644 --- a/electrum/plugins/nwc/nwcserver.py +++ b/electrum/plugins/nwc/nwcserver.py @@ -344,7 +344,7 @@ class NWCServer(Logger, EventListener): content = json.loads(content) if not isinstance(content, dict): raise Exception("malformed content, not dict") - params: dict = content['params'] + params: dict = content.get('params', {}) if not isinstance(params, dict): raise Exception("malformed params, not dict") except Exception: