From 78dcea4f235aeff0c813d2eadc4571eaa45434d0 Mon Sep 17 00:00:00 2001 From: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Date: Tue, 23 Apr 2019 15:53:50 +0800 Subject: [PATCH 1/2] Fix-heightToEnd --- CoreMetrics/CoreMetrics.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CoreMetrics/CoreMetrics.cs b/CoreMetrics/CoreMetrics.cs index a1c10af5d..33978c1a8 100644 --- a/CoreMetrics/CoreMetrics.cs +++ b/CoreMetrics/CoreMetrics.cs @@ -75,7 +75,7 @@ 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++) + for (uint i = heightToBegin; i <= heightToBegin + nBlocks; i++) { JObject json = new JObject(); Header header = Blockchain.Singleton.Store.GetHeader(i); From 47892e893ffaa2495f60b4fad648511cce2c9f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vitor=20Naz=C3=A1rio=20Coelho?= Date: Tue, 23 Apr 2019 11:27:49 -0300 Subject: [PATCH 2/2] Minor fix and comment --- CoreMetrics/CoreMetrics.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CoreMetrics/CoreMetrics.cs b/CoreMetrics/CoreMetrics.cs index 33978c1a8..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,7 +74,7 @@ private JObject GetBlocksTime(uint nBlocks, uint lastHeight) } JArray array = new JArray(); - uint heightToBegin = lastHeight > 0 ? lastHeight - nBlocks : Blockchain.Singleton.Height - nBlocks; + uint heightToBegin = lastHeight > 0 ? lastHeight - nBlocks : (Blockchain.Singleton.Height - 1) - nBlocks; for (uint i = heightToBegin; i <= heightToBegin + nBlocks; i++) { JObject json = new JObject();