config/regtest: add config to disable automatic fee updates
What changed, and why it matters
This commit adds a hidden test-only setting that prevents Electrum from automatically updating fee estimates during certain automated regtest tests. It is purely a testing helper and does not change any behavior unless the user explicitly sets the new config flag. There is no security issue visible in the change.
No security action needed. Treat as normal test-infrastructure change.
Security signals we found
No security-relevant code paths modified
New config flag is test-only and defaults to false
No input parsing, authentication, cryptography, or network trust changes
No memory safety, privilege, or resource-control changes
Evidence from the diff
The patch introduces a new boolean config variable test_disable_automatic_fee_eta_update. When true, Network.update_fee_estimates() returns early instead of fetching fresh fee estimates from the connected server. This is used together with the existing test_inject_fee_etas CLI command to make regtest fee injection deterministic. The change is gated behind an explicit config flag and is only used in the lnwatcher_waits_until_fees_go_down regtest script.
Changed components
electrum/simple_config.pyelectrum/network.pyelectrum/commands.pytests/regtest/regtest.shInspect captured patch +6 / −0
diff --git a/electrum/commands.py b/electrum/commands.py
index 8e350de..217f5ab 100644
--- a/electrum/commands.py
+++ b/electrum/commands.py
@@ -1624,6 +1624,8 @@ class Commands(Logger):
async def test_inject_fee_etas(self, fee_est):
"""
Inject fee estimates into the network object, as if they were coming from connected servers.
+ `setconfig 'test_disable_automatic_fee_eta_update' true` to prevent Network from overriding
+ the configured fees.
Useful on regtest.
arg:str:fee_est:dict of ETA-based fee estimates, encoded as str
diff --git a/electrum/network.py b/electrum/network.py
index ea38ef0..c49b48f 100644
--- a/electrum/network.py
+++ b/electrum/network.py
@@ -612,6 +612,8 @@ class Network(Logger, NetworkRetryManager[ServerAddr]):
def update_fee_estimates(self, *, fee_est: Dict[int, int] = None):
if fee_est is None:
+ if self.config.TEST_DISABLE_AUTOMATIC_FEE_ETA_UPDATE:
+ return
fee_est = self.get_fee_estimates()
for nblock_target, fee in fee_est.items():
self.fee_estimates.set_data(nblock_target, fee)
diff --git a/electrum/simple_config.py b/electrum/simple_config.py
index f356f26..b545d89 100644
--- a/electrum/simple_config.py
+++ b/electrum/simple_config.py
@@ -775,6 +775,7 @@ Warning: setting this to too low will result in lots of payment failures."""),
FEE_POLICY = ConfigVar('fee_policy.default', default='eta:2', type_=str) # exposed to GUI
FEE_POLICY_LIGHTNING = ConfigVar('fee_policy.lnwatcher', default='eta:2', type_=str) # for txbatcher (sweeping)
FEE_POLICY_SWAPS = ConfigVar('fee_policy.swaps', default='eta:2', type_=str) # for txbatcher (sweeping and sending if we are a swapserver)
+ TEST_DISABLE_AUTOMATIC_FEE_ETA_UPDATE = ConfigVar('test_disable_automatic_fee_eta_update', default=False, type_=bool)
RPC_USERNAME = ConfigVar('rpcuser', default=None, type_=str)
RPC_PASSWORD = ConfigVar('rpcpassword', default=None, type_=str)
diff --git a/tests/regtest/regtest.sh b/tests/regtest/regtest.sh
index 0473c65..c2c8301 100755
--- a/tests/regtest/regtest.sh
+++ b/tests/regtest/regtest.sh
@@ -331,6 +331,7 @@ if [[ $1 == "lnwatcher_waits_until_fees_go_down" ]]; then
$alice setconfig test_force_disable_mpp true
$alice setconfig test_force_mpp false
wait_for_balance alice 1
+ $alice setconfig test_disable_automatic_fee_eta_update true
$alice test_inject_fee_etas "{2:1000}"
$bob test_inject_fee_etas "{2:1000}"
echo "alice opens channel"
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.