Skip to content

Commit

Permalink
Fix Node Status (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
fassadlr committed Oct 8, 2021
1 parent 348489f commit a357ef5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/Stratis.Bitcoin.Features.Api/NodeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ public IActionResult Status()
ProcessId = Process.GetCurrentProcess().Id,
Network = this.fullNode.Network.Name,
ConsensusHeight = this.chainState.ConsensusTip?.Height,
HeaderHeight = this.consensusManager.HeaderTip,
DataDirectoryPath = this.nodeSettings.DataDir,
Testnet = this.network.IsTest(),
RelayFee = this.nodeSettings.MinRelayTxFeeRate?.FeePerK?.ToUnit(MoneyUnit.BTC) ?? 0,
Expand All @@ -167,6 +166,16 @@ public IActionResult Status()
InIbd = this.initialBlockDownloadState.IsInitialBlockDownload()
};

try
{
model.HeaderHeight = this.consensusManager.HeaderTip;
}
catch (Exception)
{
// It is possible that consensus manager has not yet initialized when calling this.
model.HeaderHeight = 0;
}

// Add the list of features that are enabled.
foreach (IFullNodeFeature feature in this.fullNode.Services.Features)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,6 @@ private void AddComponentStats(StringBuilder log)
if (timeHeader < currentHeader.Header.Time)
timeHeader += this.network.ConsensusOptions.TargetSpacingSeconds;

this.miningStatistics = new MiningStatisticsModel();

// Iterate mining slots.
for (int i = 0; i < maxDepth; i++)
{
Expand Down

0 comments on commit a357ef5

Please sign in to comment.