Skip to content

Commit e650561

Browse files
author
Braydon Fuller
committed
Use last block time for moreTs
1 parent 95bcad8 commit e650561

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/blocks.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,10 @@ BlockController.prototype.blockIndex = function(req, res) {
168168
});
169169
};
170170

171-
BlockController.prototype._getBlockSummary = function(hash, moreTimestamp, next) {
171+
BlockController.prototype._getBlockSummary = function(hash, next) {
172172
var self = this;
173173

174174
function finish(result) {
175-
if (moreTimestamp > result.time) {
176-
moreTimestamp = result.time;
177-
}
178175
return next(null, result);
179176
}
180177

@@ -257,7 +254,6 @@ BlockController.prototype.list = function(req, res) {
257254
var next = lte ? this.formatTimestamp(new Date(lte * 1000)) : null;
258255
var limit = parseInt(req.query.limit || BLOCK_LIMIT);
259256
var more = false;
260-
var moreTimestamp = lte;
261257

262258
self.node.services.bitcoind.getBlockHashesByTimestamp(lte, gte, function(err, hashes) {
263259
if(err) {
@@ -274,7 +270,7 @@ BlockController.prototype.list = function(req, res) {
274270
async.mapSeries(
275271
hashes,
276272
function(hash, next) {
277-
self._getBlockSummary(hash, moreTimestamp, next);
273+
self._getBlockSummary(hash, next);
278274
},
279275
function(err, blocks) {
280276
if(err) {
@@ -299,7 +295,7 @@ BlockController.prototype.list = function(req, res) {
299295
};
300296

301297
if(more) {
302-
data.pagination.moreTs = moreTimestamp;
298+
data.pagination.moreTs = blocks[blocks.length - 1].time;
303299
}
304300

305301
res.jsonp(data);

0 commit comments

Comments
 (0)