From aacc9014eafe6ef6f99b21d4a5b4e35d5994457d Mon Sep 17 00:00:00 2001 From: M Date: Wed, 18 May 2022 17:13:58 +0100 Subject: [PATCH] Change default haven node to nodes.havenprotocol.org:443 --- assets/haven_node_list.yml | 4 +--- lib/entities/default_settings_migration.dart | 17 ++++++++++++++++- lib/main.dart | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/assets/haven_node_list.yml b/assets/haven_node_list.yml index 7c6cb623c..27d9ee611 100644 --- a/assets/haven_node_list.yml +++ b/assets/haven_node_list.yml @@ -1,6 +1,4 @@ - - uri: vault.havenprotocol.org:443 - login: super - password: super + uri: nodes.havenprotocol.org:443 useSSL: true is_default: true \ No newline at end of file diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index c0e541058..ad6d0801e 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -22,7 +22,7 @@ import 'package:encrypt/encrypt.dart' as encrypt; const newCakeWalletMoneroUri = 'xmr-node.cakewallet.com:18081'; const cakeWalletBitcoinElectrumUri = 'electrum.cakewallet.com:50002'; const cakeWalletLitecoinElectrumUri = 'ltc-electrum.cakewallet.com:50002'; -const havenDefaultNodeUri = 'vault.havenprotocol.org:443'; +const havenDefaultNodeUri = 'nodes.havenprotocol.org:443'; Future defaultSettingsMigration( {@required int version, @@ -128,6 +128,10 @@ Future defaultSettingsMigration( await checkCurrentNodes(nodes, sharedPreferences); break; + case 17: + await changeDefaultHavenNode(nodes); + break; + default: break; } @@ -452,3 +456,14 @@ Future resetBitcoinElectrumServer( await oldElectrumServer?.delete(); } + +Future changeDefaultHavenNode( + Box nodeSource) async { + const previousHavenDefaultNodeUri = 'vault.havenprotocol.org:443'; + final havenNodes = nodeSource.values.where( + (node) => node.uriRaw == previousHavenDefaultNodeUri); + havenNodes.forEach((node) async { + node.uriRaw = havenDefaultNodeUri; + await node.save(); + }); +} diff --git a/lib/main.dart b/lib/main.dart index 407283f50..b9f8074e7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -126,7 +126,7 @@ Future main() async { exchangeTemplates: exchangeTemplates, transactionDescriptions: transactionDescriptions, secureStorage: secureStorage, - initialMigrationVersion: 16); + initialMigrationVersion: 17); runApp(App()); } catch (e) { runApp(MaterialApp(