Skip to content

Commit

Permalink
Merge pull request #376 from braydonf/bug/block-txs-paging
Browse files Browse the repository at this point in the history
Fix bug where page 0 is falsy and pagination would not be enabled.
  • Loading branch information
kleetus committed Sep 22, 2015
2 parents 778c09b + 8a21f48 commit 52b02ed
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/transactions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var bitcore = require('bitcore');
var _ = bitcore.deps._;
var common = require('./common');
var async = require('async');

Expand Down Expand Up @@ -31,7 +32,7 @@ TxController.prototype.transaction = function(req, res, next, txid) {
if(err) {
return res.send({
error: err.toString()
})
});
}

req.transaction = self.transformTransaction(transaction);
Expand Down Expand Up @@ -206,7 +207,7 @@ TxController.prototype.list = function(req, res) {
var txs = block.transactions;
var totalTxs = txs.length;

if(page) {
if(!_.isUndefined(page)) {
txs = txs.splice(page * pageLength, pageLength);
pagesTotal = Math.ceil(totalTxs / pageLength);
}
Expand Down Expand Up @@ -275,4 +276,4 @@ TxController.prototype.send = function(req, res) {
});
};

module.exports = TxController;
module.exports = TxController;

0 comments on commit 52b02ed

Please sign in to comment.