Merge pull request #282 from cmgustavo/bug/01blocklist-limit
fix issue #281
This commit is contained in:
commit
48fc983803
|
@ -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,{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -29,8 +29,7 @@ angular.module('insight.system').controller('IndexController',
|
|||
}
|
||||
});
|
||||
|
||||
socket.on('block', function(block) {
|
||||
var blockHash = block.toString();
|
||||
socket.on('block', function() {
|
||||
_getBlocks();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue