|
@ -196,13 +196,17 @@ router.get("/blocks", function(req, res) { |
|
|
var blockHeights = []; |
|
|
var blockHeights = []; |
|
|
if (sort == "desc") { |
|
|
if (sort == "desc") { |
|
|
for (var i = (getblockchaininfo.blocks - offset); i > (getblockchaininfo.blocks - offset - limit); i--) { |
|
|
for (var i = (getblockchaininfo.blocks - offset); i > (getblockchaininfo.blocks - offset - limit); i--) { |
|
|
|
|
|
if (i >= 0) { |
|
|
blockHeights.push(i); |
|
|
blockHeights.push(i); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
for (var i = offset; i < (offset + limit); i++) { |
|
|
for (var i = offset; i < (offset + limit); i++) { |
|
|
|
|
|
if (i >= 0) { |
|
|
blockHeights.push(i); |
|
|
blockHeights.push(i); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
coreApi.getBlocksByHeight(blockHeights).then(function(blocks) { |
|
|
coreApi.getBlocksByHeight(blockHeights).then(function(blocks) { |
|
|
res.locals.blocks = blocks; |
|
|
res.locals.blocks = blocks; |
|
|