Merge pull request #55 from periodic1236/master

Sort block list by height
This commit is contained in:
Matias Alejo Garcia 2014-04-23 23:01:50 -03:00
commit d6c21026c2
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,