config: allow setting "forgetconfig" option in file, not just on CLI
What changed, and why it matters
This is a small bug-fix for how Electrum handles a setting called 'forgetconfig'. Previously, the command-line default of 'false' always overrode the value stored in the user's config file, making it impossible to enable the setting inside the config file. The change lets users set it in the config file as intended. It is not a security vulnerability fix; it is a usability/config fix.
No security action required. Treat as a normal configuration/usability fix.
Security signals we found
No security-relevant behavior change: the 'forget config on exit' feature already existed as a CLI flag
Change only affects config precedence between CLI default and config file
Added warning log improves observability rather than weakening security
Evidence from the diff
The patch changes the argparse default for –forgetconfig from False to None in commands.py, so the CLI no longer clobbers a config-file value. It also adds a log warning in simple_config.py when config changes are not saved because CONFIG_FORGET_CHANGES is set. The commit message explicitly frames this as allowing the option to be set in the file, not just on the CLI, and notes that setconfig still cannot set it because the setting prevents writing the config file.
Changed components
electrum/commands.pyelectrum/simple_config.pyInspect captured patch +2 / −1
diff --git a/electrum/commands.py b/electrum/commands.py
index 45e3d92..87dcd83 100644
--- a/electrum/commands.py
+++ b/electrum/commands.py
@@ -2397,7 +2397,7 @@ def add_global_options(parser, suppress=False):
"--rpcpassword", dest=SimpleConfig.RPC_PASSWORD.key(), default=argparse.SUPPRESS,
help=argparse.SUPPRESS if suppress else "RPC password")
group.add_argument(
- "--forgetconfig", action="store_true", dest=SimpleConfig.CONFIG_FORGET_CHANGES.key(), default=False,
+ "--forgetconfig", action="store_true", dest=SimpleConfig.CONFIG_FORGET_CHANGES.key(), default=None,
help=argparse.SUPPRESS if suppress else "Forget config on exit")
diff --git a/electrum/simple_config.py b/electrum/simple_config.py
index a748186..2d3ec00 100644
--- a/electrum/simple_config.py
+++ b/electrum/simple_config.py
@@ -446,6 +446,7 @@ class SimpleConfig(Logger):
def save_user_config(self):
if self.CONFIG_FORGET_CHANGES:
+ self.logger.warning(f"not saving config changes to disk as {self.cv.CONFIG_FORGET_CHANGES.key()} is set", only_once=True)
return
if not self.path:
return
Why this scored 16/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.