Fix epicbox config issue when creating new wallet

This commit is contained in:
likho 2023-02-25 11:42:21 +02:00
parent f21e4727fa
commit 716dbe706b

View file

@ -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<String, String> textSocketProcessor =
@ -1038,8 +1038,9 @@ class EpicCashWallet extends CoinServiceAPI
Future<String> 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,8 +1048,9 @@ 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);
}
}
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);
@ -1061,7 +1063,6 @@ class EpicCashWallet extends CoinServiceAPI
return storedConfig;
}
}
Future<String> getRealConfig() async {
String? config = await _secureStore.read(key: '${_walletId}_config');