Merge pull request #425 from jpochyla/fix-tx-pagination

Fix pagination of transaction history
This commit is contained in:
Braydon Fuller 2016-04-07 10:10:45 -04:00
commit 3863f5ce9b

View File

@ -119,8 +119,8 @@ AddressHistory.prototype._paginateWithDetails = function(allTxids, callback) {
// Slice the page starting with the most recent
var txids;
if (self.options.from >= 0 && self.options.to >= 0) {
var fromOffset = totalCount - self.options.from;
var toOffset = totalCount - self.options.to;
var fromOffset = Math.max(0, totalCount - self.options.from);
var toOffset = Math.max(0, totalCount - self.options.to);
txids = allTxids.slice(toOffset, fromOffset);
} else {
txids = allTxids;