Skip to content

Commit

Permalink
- fixed incorrect node stall state update when in verbose mode
Browse files Browse the repository at this point in the history
- fixed startup crash issue
  • Loading branch information
firestorm40 committed Feb 7, 2023
1 parent 8fd4b03 commit ffda9f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
14 changes: 12 additions & 2 deletions SpixiBot/Meta/Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
using SpixiBot.Network;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using Activity = IXICore.Meta.Activity;

namespace SpixiBot.Meta
{
Expand Down Expand Up @@ -245,9 +247,9 @@ public void start(bool verboseConsoleOutput)
// Start the HTTP JSON API server
apiServer = new APIServer(Config.apiBinds, Config.apiUsers, Config.apiAllowedIps);

if (IXICore.Platform.onMono() == false && !Config.disableWebStart)
if (Platform.onWindows() == true && !Config.disableWebStart)
{
System.Diagnostics.Process.Start(Config.apiBinds[0]);
Process.Start(new ProcessStartInfo(Config.apiBinds[0]) { UseShellExecute = true });
}

// Prepare stats screen
Expand Down Expand Up @@ -311,6 +313,14 @@ static public bool update()
}
}

if (IxianHandler.status != NodeStatus.warmUp)
{
if (Clock.getTimestamp() - BlockHeaderStorage.lastBlockHeaderTime > 1800) // if no block for over 1800 seconds
{
IxianHandler.status = NodeStatus.stalled;
}
}

return running;
}

Expand Down
3 changes: 1 addition & 2 deletions SpixiBot/Meta/StatsConsoleScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,10 @@ public void drawScreen()
if (connectionsIn + connectionsOut < 1)
dltStatus = "connecting ";

if (Clock.getTimestamp() - BlockHeaderStorage.lastBlockHeaderTime > 1800) // if no block for over 1800 seconds
if (IxianHandler.status == NodeStatus.stalled) // if node is stalled
{
Console.ForegroundColor = ConsoleColor.Red;
dltStatus = "No block received for over 30 minutes";
IxianHandler.status = NodeStatus.stalled;
}

writeLine(dltStatus);
Expand Down

0 comments on commit ffda9f6

Please sign in to comment.