diff --git a/lib/services/coins/epiccash/epiccash_wallet.dart b/lib/services/coins/epiccash/epiccash_wallet.dart index bdb6b7add..8785661c9 100644 --- a/lib/services/coins/epiccash/epiccash_wallet.dart +++ b/lib/services/coins/epiccash/epiccash_wallet.dart @@ -1003,7 +1003,7 @@ class EpicCashWallet extends CoinServiceAPI /// Set this attribute to `true` if do not need any ping/pong /// messages and ping measurement. Default is `false` - pingRestrictionForce: false, + pingRestrictionForce: true, ); final IMessageProcessor textSocketProcessor = @@ -1038,8 +1038,9 @@ class EpicCashWallet extends CoinServiceAPI Future getEpicBoxConfig() async { String? storedConfig = await _secureStore.read(key: '${_walletId}_epicboxConfig'); + if (storedConfig == null) { - return json.encode(DefaultNodes.defaultEpicBoxConfig); + storedConfig = DefaultNodes.defaultEpicBoxConfig; } else { dynamic decoded = json.decode(storedConfig!); final domain = decoded["domain"] ?? "empty"; @@ -1047,20 +1048,20 @@ class EpicCashWallet extends CoinServiceAPI //If we have the old invalid config, use the new default one // new storage format stores domain under "epicbox_domain", old storage format used "domain" storedConfig = DefaultNodes.defaultEpicBoxConfig; - decoded = json.decode(storedConfig); } - //Check Epicbox is up before returning it - bool isEpicboxConnected = await testEpicboxServer( - decoded["epicbox_domain"] as String, decoded["epicbox_port"] as int); - - if (!isEpicboxConnected) { - //Default Epicbox is not connected, Defaulting to Europe - storedConfig = json.encode(DefaultNodes.epicBoxConfigEUR); - // TODO test this connection before returning it, iterating through the list of default Epic Box servers - } - - return storedConfig; } + final decoded = json.decode(storedConfig); + //Check Epicbox is up before returning it + bool isEpicboxConnected = await testEpicboxServer( + decoded["epicbox_domain"] as String, decoded["epicbox_port"] as int); + + if (!isEpicboxConnected) { + //Default Epicbox is not connected, Defaulting to Europe + storedConfig = json.encode(DefaultNodes.epicBoxConfigEUR); + // TODO test this connection before returning it, iterating through the list of default Epic Box servers + } + + return storedConfig; } Future getRealConfig() async {