diff --git a/src/Stratis.Bitcoin.Features.Api/NodeController.cs b/src/Stratis.Bitcoin.Features.Api/NodeController.cs index 79544a06ad..2bd7edced2 100644 --- a/src/Stratis.Bitcoin.Features.Api/NodeController.cs +++ b/src/Stratis.Bitcoin.Features.Api/NodeController.cs @@ -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, @@ -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) { diff --git a/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs b/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs index 25b9f0d8cd..4c2ee2fecd 100644 --- a/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs +++ b/src/Stratis.Bitcoin.Features.PoA/PoAMiner.cs @@ -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++) {