mirror of
https://github.com/basicswap/basicswap.git
synced 2026-04-08 18:37:23 +02:00
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:
@@ -2469,11 +2469,7 @@ def main():
|
|||||||
server_str = s[1].strip()
|
server_str = s[1].strip()
|
||||||
parts = server_str.split(":")
|
parts = server_str.split(":")
|
||||||
if len(parts) >= 2:
|
if len(parts) >= 2:
|
||||||
server = {
|
server = f"{parts[0]}:{parts[1]}"
|
||||||
"host": parts[0],
|
|
||||||
"port": int(parts[1]),
|
|
||||||
"ssl": parts[2].lower() == "true" if len(parts) > 2 else True,
|
|
||||||
}
|
|
||||||
if coin_prefix not in electrum_servers:
|
if coin_prefix not in electrum_servers:
|
||||||
electrum_servers[coin_prefix] = []
|
electrum_servers[coin_prefix] = []
|
||||||
electrum_servers[coin_prefix].append(server)
|
electrum_servers[coin_prefix].append(server)
|
||||||
|
|||||||
@@ -371,6 +371,19 @@ def runClient(
|
|||||||
with open(settings_path) as fs:
|
with open(settings_path) as fs:
|
||||||
settings = json.load(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(
|
swap_client = BasicSwap(
|
||||||
data_dir, settings, chain, log_name=log_prefix, extra_opts=extra_opts
|
data_dir, settings, chain, log_name=log_prefix, extra_opts=extra_opts
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user