Sort block list by height

This commit is contained in:
periodic1236 2014-04-23 16:20:03 -07:00
parent 32fdb05097
commit 2dd7196d13
1 changed files with 8 additions and 0 deletions

View File

@ -139,6 +139,14 @@ exports.list = function(req, res) {
});
});
}, 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({
blocks: allblocks,
length: allblocks.length,