diff --git a/CoreMetrics/CoreMetrics.cs b/CoreMetrics/CoreMetrics.cs index a1c10af5d..5be9d35ca 100644 --- a/CoreMetrics/CoreMetrics.cs +++ b/CoreMetrics/CoreMetrics.cs @@ -64,7 +64,7 @@ private JObject GetBlocksTime(uint nBlocks, uint lastHeight) if (nBlocks >= Blockchain.Singleton.Height) { JObject json = new JObject(); - return json["error"] = "Requested number of blocks timestamps exceeds quantity of known blocks " + Blockchain.Singleton.Height; + return json["error"] = "Requested number of blocks timestamps " + nBlocks + " exceeds quantity of known blocks " + Blockchain.Singleton.Height; } if (nBlocks <= 0) @@ -74,8 +74,8 @@ private JObject GetBlocksTime(uint nBlocks, uint lastHeight) } JArray array = new JArray(); - uint heightToBegin = lastHeight > 0 ? lastHeight - nBlocks : Blockchain.Singleton.Height - nBlocks; - for (uint i = heightToBegin; i <= Blockchain.Singleton.HeaderHeight; i++) + uint heightToBegin = lastHeight > 0 ? lastHeight - nBlocks : (Blockchain.Singleton.Height - 1) - nBlocks; + for (uint i = heightToBegin; i <= heightToBegin + nBlocks; i++) { JObject json = new JObject(); Header header = Blockchain.Singleton.Store.GetHeader(i);