From 21248817c9952965f8957743eeef45b07a53db91 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 19 Jan 2026 11:30:53 +0000 Subject: [PATCH] config: allow setting "forgetconfig" option in file, not just on CLI - by specifying "default=" in commands.py, would always overwrite what is in the config file - note `$ ./run_electrum -o setconfig forget_config true` still does not work, as that first sets forget_config in memory, and then - by virtue of the setting - it refuses to write changes to the config file - hence this option would have to be set manually by editing the json (or as a CLI flag, as before) ref https://github.com/spesmilo/electrum/pull/10421#issuecomment-3765862081 --- electrum/commands.py | 2 +- electrum/simple_config.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/electrum/commands.py b/electrum/commands.py index 45e3d92c8..87dcd83a9 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 a74818626..2d3ec005e 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