Merge pull request #282 from cmgustavo/bug/01blocklist-limit

fix issue #281
This commit is contained in:
Mario Colque 2014-02-13 11:25:19 -02:00
commit 48fc983803
3 changed files with 8 additions and 4 deletions

View File

@ -106,11 +106,16 @@ exports.list = function(req, res) {
res.status(500).send(err);
}
else {
var blockList = [];
var l = blocks.length;
var limit = parseInt(req.query.limit || l);
if (l < limit) limit = l;
async.mapSeries(blocks,
for(var i=0;i<limit;i++) {
blockList.push(blocks[i]);
}
async.mapSeries(blockList,
function(b, cb) {
getBlock(b.hash, function(err, info) {
return cb(err,{

View File

@ -124,7 +124,7 @@ function spec(b) {
// .has() return true orphans also
BlockDb.prototype.has = function(hash, cb) {
var k = PREV_PREFIX + hash;
db.get(k, function (err,val) {
db.get(k, function (err) {
var ret = true;
if (err && err.notFound) {
err = null;

View File

@ -29,8 +29,7 @@ angular.module('insight.system').controller('IndexController',
}
});
socket.on('block', function(block) {
var blockHash = block.toString();
socket.on('block', function() {
_getBlocks();
});