Sort block list by height
This commit is contained in:
parent
32fdb05097
commit
2dd7196d13
@ -139,6 +139,14 @@ exports.list = function(req, res) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, function(err, allblocks) {
|
}, function(err, allblocks) {
|
||||||
|
// sort blocks by height
|
||||||
|
allblocks.sort(
|
||||||
|
function compare(a,b) {
|
||||||
|
if (a.height < b.height) return 1;
|
||||||
|
if (a.height > b.height) return -1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
res.jsonp({
|
res.jsonp({
|
||||||
blocks: allblocks,
|
blocks: allblocks,
|
||||||
length: allblocks.length,
|
length: allblocks.length,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user