internal async void TestNodes() { while (true) { bot = new TelegramBot(accessToken: ConfigurationManager.AppSettings[name: "accessKey"]); var nodes = NodeUtils.GetAllNodes(); foreach (var n in nodes) { Thread.Sleep(500); try { var con = new Connection(); con.SetHost(n.IP); con.AutoHost = false; var client = new NodeClient(con); var info = client.EndGetExtendedNodeInfo(client.BeginGetExtendedNodeInfo()); if (n.WentOffLine != null) { var nis = new NisClient(con); if (nis.EndGetStatus(nis.BeginGetStatus()).Code != 6) { continue; } await Nofity( node : n, msg : "Node: " + n.Alias + "\n" + " With IP: " + n.IP + "\nis back online."); n.WentOffLine = null; NodeUtils.UpdateNode(snode: n, chatId: n.OwnedByUser); } if (info.Node.endpoint.Host == n.IP) { ScanTests(n: n); } } catch (Exception e) { if (e.Message.Contains("blocked")) { AccountUtils.DeleteAccountsByUser(n.OwnedByUser); NodeUtils.DeleteUserNodes(n.OwnedByUser); UserUtils.DeleteUser(n.OwnedByUser); break; } if (n.WentOffLine == null) { try { await Nofity(node : n, msg : "Node: " + n.Alias + "\n" + "With IP: " + n.IP + " \nis offline or otherwise unreachable. It will be removed from your list of registered nodes in 48 hours if it is not reachable in that time."); } catch (Exception ex) { await Nofity(node : n, msg : "Node: " + n.Alias + "\n" + "With IP: " + n.IP + " \nis offline or otherwise unreachable. It will be removed from your list of registered nodes in 48 hours if it is not reachable in that time."); } n.WentOffLine = DateTime.Now; NodeUtils.UpdateNode(snode: n, chatId: n.OwnedByUser); } else if (n.WentOffLine < DateTime.Now.AddDays(value: -2)) { await Nofity(node : n, msg : "Node: " + n.IP + " has been offline or otherwise unreachable for 48 hours. It will be removed from your list of registered nodes."); NodeUtils.DeleteNode( chatId: (long)n.OwnedByUser, nodes: new List <string> { n.IP }); AccountUtils.DeleteAccount( chatId: (long)n.OwnedByUser, accounts: new List <string> { AccountUtils.GetAccount(add: n.DepositAddress, user: (long)n.OwnedByUser).EncodedAddress } ); } } } } }