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,8 +157,11 @@ Future defaultSettingsMigration(
Future<void> addOnionNode(Box<Node> nodes) async {
final onionNodeUri = "cakexmrl7bonq7ovjka5kuwuyd3f7qnkz6z6s6dmsy3uckwra7bvggyd.onion:18081";
// 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 {
final replaceNodes = <String, Node>{