diff --git a/assets/node_list.yml b/assets/node_list.yml index bc7a9dc4a..d04a9a2e8 100644 --- a/assets/node_list.yml +++ b/assets/node_list.yml @@ -17,6 +17,3 @@ - uri: node.community.rino.io:18081 is_default: false -- - uri: node.moneroworld.com:18089 - is_default: false diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index 3aad38179..802ad0184 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -40,6 +40,7 @@ const solanaDefaultNodeUri = 'rpc.ankr.com'; const tronDefaultNodeUri = 'trx.nownodes.io'; const newCakeWalletBitcoinUri = 'btc-electrum.cakewallet.com:50002'; const wowneroDefaultNodeUri = 'node3.monerodevs.org:34568'; +const moneroWorldNodeUri = '.moneroworld.com'; Future defaultSettingsMigration( {required int version, @@ -245,6 +246,9 @@ Future defaultSettingsMigration( _fixNodesUseSSLFlag(nodes); await changeDefaultNanoNode(nodes, sharedPreferences); break; + case 40: + await removeMoneroWorld(sharedPreferences: sharedPreferences, nodes: nodes); + break; default: break; } @@ -488,15 +492,7 @@ Node? getBitcoinCashDefaultElectrumServer({required Box nodes}) { Node getMoneroDefaultNode({required Box nodes}) { final timeZone = DateTime.now().timeZoneOffset.inHours; - var nodeUri = ''; - - if (timeZone >= 1) { - // Eurasia - nodeUri = 'xmr-node-eu.cakewallet.com:18081'; - } else if (timeZone <= -4) { - // America - nodeUri = 'xmr-node-usa-east.cakewallet.com:18081'; - } + var nodeUri = newCakeWalletMoneroUri; try { return nodes.values.firstWhere((Node node) => node.uriRaw == nodeUri); @@ -1260,3 +1256,22 @@ Future replaceTronDefaultNode({ // If it's not, we switch user to the new default node: NowNodes await changeTronCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes); } + +Future removeMoneroWorld( + {required SharedPreferences sharedPreferences, required Box nodes}) async { + const cakeWalletMoneroNodeUriPattern = '.moneroworld.com'; + final currentMoneroNodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey); + final currentMoneroNode = nodes.values.firstWhere((node) => node.key == currentMoneroNodeId); + final needToReplaceCurrentMoneroNode = currentMoneroNode.uri.toString().contains(cakeWalletMoneroNodeUriPattern); + + nodes.values.forEach((node) async { + if (node.type == WalletType.monero && + node.uri.toString().contains(cakeWalletMoneroNodeUriPattern)) { + await node.delete(); + } + }); + + if (needToReplaceCurrentMoneroNode) { + await changeMoneroCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes); + } +} diff --git a/lib/main.dart b/lib/main.dart index 86a278fdc..cae528210 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -186,7 +186,7 @@ Future initializeAppConfigs() async { transactionDescriptions: transactionDescriptions, secureStorage: secureStorage, anonpayInvoiceInfo: anonpayInvoiceInfo, - initialMigrationVersion: 39, + initialMigrationVersion: 40, ); }