Change default haven node to nodes.havenprotocol.org:443

M committed May 18, 2022 at 17:13 UTC aacc9014eafe6ef6f99b21d4a5b4e35d5994457d
3 files changed +18 -5
assets/haven_node_list.yml
+1 -3
@@ -1,6 +1,4 @@
1 -
2 - uri: vault.havenprotocol.org:443
3 - login: super
4 - password: super
2 + uri: nodes.havenprotocol.org:443
3 useSSL: true
4 is_default: true
\ No newline at end of file
lib/entities/default_settings_migration.dart
+16 -1
@@ -22,7 +22,7 @@ import 'package:encrypt/encrypt.dart' as encrypt;
22 const newCakeWalletMoneroUri = 'xmr-node.cakewallet.com:18081';
23 const cakeWalletBitcoinElectrumUri = 'electrum.cakewallet.com:50002';
24 const cakeWalletLitecoinElectrumUri = 'ltc-electrum.cakewallet.com:50002';
25 -const havenDefaultNodeUri = 'vault.havenprotocol.org:443';
25 +const havenDefaultNodeUri = 'nodes.havenprotocol.org:443';
26
27 Future defaultSettingsMigration(
28 {@required int version,
@@ -128,6 +128,10 @@ Future defaultSettingsMigration(
128 await checkCurrentNodes(nodes, sharedPreferences);
129 break;
130
131 + case 17:
132 + await changeDefaultHavenNode(nodes);
133 + break;
134 +
135 default:
136 break;
137 }
@@ -452,3 +456,14 @@ Future<void> resetBitcoinElectrumServer(
456
457 await oldElectrumServer?.delete();
458 }
459 +
460 +Future<void> changeDefaultHavenNode(
461 + Box<Node> nodeSource) async {
462 + const previousHavenDefaultNodeUri = 'vault.havenprotocol.org:443';
463 + final havenNodes = nodeSource.values.where(
464 + (node) => node.uriRaw == previousHavenDefaultNodeUri);
465 + havenNodes.forEach((node) async {
466 + node.uriRaw = havenDefaultNodeUri;
467 + await node.save();
468 + });
469 +}
lib/main.dart
+1 -1
@@ -126,7 +126,7 @@ Future<void> main() async {
126 exchangeTemplates: exchangeTemplates,
127 transactionDescriptions: transactionDescriptions,
128 secureStorage: secureStorage,
129 - initialMigrationVersion: 16);
129 + initialMigrationVersion: 17);
130 runApp(App());
131 } catch (e) {
132 runApp(MaterialApp(