Check if user already has onion node before adding it

This commit is contained in:
OmarHatem 2022-12-01 14:29:03 +02:00
parent f54e2ec00e
commit ffd0079e1d

View file

@ -157,7 +157,10 @@ Future defaultSettingsMigration(
Future<void> addOnionNode(Box<Node> nodes) async { Future<void> addOnionNode(Box<Node> nodes) async {
final onionNodeUri = "cakexmrl7bonq7ovjka5kuwuyd3f7qnkz6z6s6dmsy3uckwra7bvggyd.onion:18081"; final onionNodeUri = "cakexmrl7bonq7ovjka5kuwuyd3f7qnkz6z6s6dmsy3uckwra7bvggyd.onion:18081";
await nodes.add(Node(uri: onionNodeUri, type: WalletType.monero)); // check if the user has this node before (added it manually)
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == onionNodeUri) == null) {
await nodes.add(Node(uri: onionNodeUri, type: WalletType.monero));
}
} }
Future<void> replaceNodesMigration({required Box<Node> nodes}) async { Future<void> replaceNodesMigration({required Box<Node> nodes}) async {