diff --git a/basicswap/bin/prepare.py b/basicswap/bin/prepare.py index df1a72d..1578a76 100755 --- a/basicswap/bin/prepare.py +++ b/basicswap/bin/prepare.py @@ -161,10 +161,10 @@ expected_key_ids = { } GUIX_SSL_CERT_DIR = None -OVERRIDE_DISABLED_COINS = toBool(os.getenv("OVERRIDE_DISABLED_COINS", "false")) +OVERRIDE_DISABLED_COINS = toBool(os.getenv("OVERRIDE_DISABLED_COINS", False)) # If SKIP_GPG_VALIDATION is set to true the script will check hashes but not signatures -SKIP_GPG_VALIDATION = toBool(os.getenv("SKIP_GPG_VALIDATION", "false")) +SKIP_GPG_VALIDATION = toBool(os.getenv("SKIP_GPG_VALIDATION", False)) USE_PLATFORM = os.getenv("USE_PLATFORM", platform.system()) if USE_PLATFORM == "Darwin": @@ -192,11 +192,11 @@ if not len(logger.handlers): logger.addHandler(logging.StreamHandler(sys.stdout)) logging.getLogger("gnupg").setLevel(logging.INFO) -BSX_DOCKER_MODE = toBool(os.getenv("BSX_DOCKER_MODE", "false")) -BSX_LOCAL_TOR = toBool(os.getenv("BSX_LOCAL_TOR", "false")) -BSX_TEST_MODE = toBool(os.getenv("BSX_TEST_MODE", "false")) +BSX_DOCKER_MODE = toBool(os.getenv("BSX_DOCKER_MODE", False)) +BSX_LOCAL_TOR = toBool(os.getenv("BSX_LOCAL_TOR", False)) +BSX_TEST_MODE = toBool(os.getenv("BSX_TEST_MODE", False)) BSX_UPDATE_UNMANAGED = toBool( - os.getenv("BSX_UPDATE_UNMANAGED", "true") + os.getenv("BSX_UPDATE_UNMANAGED", True) ) # Disable updating unmanaged coin cores. UI_HTML_PORT = int(os.getenv("UI_HTML_PORT", 12700)) UI_WS_PORT = int(os.getenv("UI_WS_PORT", 11700)) @@ -321,10 +321,8 @@ def setTorrcVars(): ) -TEST_TOR_PROXY = toBool( - os.getenv("TEST_TOR_PROXY", "true") -) # Expects a known exit node -TEST_ONION_LINK = toBool(os.getenv("TEST_ONION_LINK", "false")) +TEST_TOR_PROXY = toBool(os.getenv("TEST_TOR_PROXY", True)) # Expects a known exit node +TEST_ONION_LINK = toBool(os.getenv("TEST_ONION_LINK", False)) BITCOIN_FASTSYNC_URL = os.getenv( "BITCOIN_FASTSYNC_URL", @@ -341,6 +339,8 @@ BITCOIN_FASTSYNC_SIG_URL = os.getenv( # Encrypt new wallets with this password, must match the Particl wallet password when adding coins WALLET_ENCRYPTION_PWD = os.getenv("WALLET_ENCRYPTION_PWD", "") +CHECK_FOR_BSX_UPDATES = toBool(os.getenv("CHECK_FOR_BSX_UPDATES", True)) + use_tor_proxy: bool = False with_coins_changed: bool = False @@ -2973,7 +2973,7 @@ def main(): save_config(config_path, settings) logger.info("Done.") return 0 - exitWithError("{} is already in the settings file".format(add_coin)) + exitWithError(f"{add_coin} is already in the settings file") if tor_control_password is None and settings.get("use_tor", False): extra_opts["tor_control_password"] = settings.get( @@ -3274,6 +3274,11 @@ def main(): settings["wshost"] = wshost settings["wsport"] = UI_WS_PORT + port_offset + if "CHECK_FOR_BSX_UPDATES" in os.environ: + settings["check_updates"] = CHECK_FOR_BSX_UPDATES + elif BSX_TEST_MODE is True: + settings["check_updates"] = False + if use_tor_proxy: tor_control_password = generate_salt(24) addTorSettings(settings, tor_control_password) diff --git a/tests/basicswap/extended/test_dash.py b/tests/basicswap/extended/test_dash.py index 92ee00c..b587aad 100644 --- a/tests/basicswap/extended/test_dash.py +++ b/tests/basicswap/extended/test_dash.py @@ -55,6 +55,7 @@ from tests.basicswap.common import ( wait_for_unspent, wait_for_bid_tx_state, wait_for_in_progress, + TEST_HTTP_HOST, TEST_HTTP_PORT, BASE_PORT, BASE_RPC_PORT, @@ -163,8 +164,8 @@ def prepareDir(datadir, nodeId, network_key, network_pubkey): "debug": True, "zmqhost": "tcp://127.0.0.1", "zmqport": BASE_ZMQ_PORT + nodeId, - "htmlhost": "127.0.0.1", - "htmlport": 12700 + nodeId, + "htmlhost": TEST_HTTP_HOST, + "htmlport": TEST_HTTP_PORT + nodeId, "network_key": network_key, "network_pubkey": network_pubkey, "chainclients": { @@ -206,6 +207,7 @@ def prepareDir(datadir, nodeId, network_key, network_pubkey): "min_delay_retry": 2, "max_delay_retry": 10, "restrict_unknown_seed_wallets": False, + "check_updates": False, } with open(settings_path, "w") as fp: json.dump(settings, fp, indent=4) diff --git a/tests/basicswap/extended/test_network.py b/tests/basicswap/extended/test_network.py index 2414426..370706c 100644 --- a/tests/basicswap/extended/test_network.py +++ b/tests/basicswap/extended/test_network.py @@ -119,6 +119,7 @@ def prepare_swapclient_dir(datadir, node_id, network_key, network_pubkey): "min_delay_retry": 2, "max_delay_retry": 10, "restrict_unknown_seed_wallets": False, + "check_updates": False, } with open(settings_path, "w") as fp: diff --git a/tests/basicswap/extended/test_pivx.py b/tests/basicswap/extended/test_pivx.py index 6b4caa9..cd8acfb 100644 --- a/tests/basicswap/extended/test_pivx.py +++ b/tests/basicswap/extended/test_pivx.py @@ -55,6 +55,7 @@ from tests.basicswap.common import ( wait_for_unspent, wait_for_in_progress, wait_for_bid_tx_state, + TEST_HTTP_HOST, TEST_HTTP_PORT, BASE_PORT, BASE_RPC_PORT, @@ -169,8 +170,8 @@ def prepareDir(datadir, nodeId, network_key, network_pubkey): "debug": True, "zmqhost": "tcp://127.0.0.1", "zmqport": BASE_ZMQ_PORT + nodeId, - "htmlhost": "127.0.0.1", - "htmlport": 12700 + nodeId, + "htmlhost": TEST_HTTP_HOST, + "htmlport": TEST_HTTP_PORT + nodeId, "network_key": network_key, "network_pubkey": network_pubkey, "chainclients": { @@ -212,6 +213,7 @@ def prepareDir(datadir, nodeId, network_key, network_pubkey): "min_delay_retry": 2, "max_delay_retry": 10, "restrict_unknown_seed_wallets": False, + "check_updates": False, } with open(settings_path, "w") as fp: json.dump(settings, fp, indent=4) diff --git a/tests/basicswap/test_reload.py b/tests/basicswap/test_reload.py index a87fbfe..5bba15b 100644 --- a/tests/basicswap/test_reload.py +++ b/tests/basicswap/test_reload.py @@ -77,7 +77,7 @@ class Test(unittest.TestCase): prepare_nodes(3, "bitcoin") def run_thread(self, client_id): - client_path = os.path.join(TEST_PATH, "client{}".format(client_id)) + client_path = os.path.join(TEST_PATH, f"client{client_id}") testargs = [ "basicswap-run", "-datadir=" + client_path, diff --git a/tests/basicswap/test_xmr.py b/tests/basicswap/test_xmr.py index 88e1ddb..26b7d6e 100644 --- a/tests/basicswap/test_xmr.py +++ b/tests/basicswap/test_xmr.py @@ -190,6 +190,7 @@ def prepare_swapclient_dir( "max_delay_retry": 10, "debug_ui": True, "restrict_unknown_seed_wallets": False, + "check_updates": False, } if BTC_USE_DESCRIPTORS: