private static bool NoteIsHealthy(IIotaNodeRepository node) { try { var nodeInfo = node.GetNodeInfo(); return(nodeInfo.LatestMilestoneIndex == nodeInfo.LatestSolidSubtangleMilestoneIndex); } catch { return(false); } }
/// <summary> /// The node is healthy. /// </summary> /// <param name="node"> /// The node. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public static bool NodeIsHealthy(IIotaNodeRepository node) { try { // Timeout after 5 seconds var task = Task.Run(() => node.GetNodeInfo()); if (task.Wait(TimeSpan.FromSeconds(WaitSeconds))) { var nodeInfo = task.Result; return(nodeInfo.LatestMilestoneIndex == nodeInfo.LatestSolidSubtangleMilestoneIndex); } } catch { // ignored } return(false); }