From 9ecaa79933dc116bf8ce5d3bc6761ee0bd500263 Mon Sep 17 00:00:00 2001 From: Dan Janosik Date: Mon, 2 Jul 2018 15:00:08 -0400 Subject: [PATCH] don't try to find blocks with heights less than zero --- routes/baseActionsRouter.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/routes/baseActionsRouter.js b/routes/baseActionsRouter.js index 89b0f09..4822de9 100644 --- a/routes/baseActionsRouter.js +++ b/routes/baseActionsRouter.js @@ -196,11 +196,15 @@ router.get("/blocks", function(req, res) { var blockHeights = []; if (sort == "desc") { for (var i = (getblockchaininfo.blocks - offset); i > (getblockchaininfo.blocks - offset - limit); i--) { - blockHeights.push(i); + if (i >= 0) { + blockHeights.push(i); + } } } else { for (var i = offset; i < (offset + limit); i++) { - blockHeights.push(i); + if (i >= 0) { + blockHeights.push(i); + } } }