Fix: Use string format for electrum servers host:port with prepare.

- Added temp check if config using old object-format servers and convert them to the strings and saves to basicswap.json.
This commit is contained in:
gerlofvanek
2026-01-29 16:48:24 +01:00
parent d1552717ae
commit 12e3d3bab8
2 changed files with 14 additions and 5 deletions

View File

@@ -371,6 +371,19 @@ def runClient(
with open(settings_path) as fs:
settings = json.load(fs)
# TEMP:
config_changed = False
for coin_name, coin_data in settings.get("chainclients", {}).items():
for key in ["electrum_clearnet_servers", "electrum_onion_servers"]:
servers = coin_data.get(key)
if servers and isinstance(servers, list) and len(servers) > 0:
if isinstance(servers[0], dict):
coin_data[key] = [f"{s['host']}:{s['port']}" for s in servers]
config_changed = True
if config_changed:
with open(settings_path, "w") as fs:
json.dump(settings, fs, indent=4)
swap_client = BasicSwap(
data_dir, settings, chain, log_name=log_prefix, extra_opts=extra_opts
)