From 8a21f48d2aed2a22cb9028fb37de41dff76fb5d2 Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Mon, 21 Sep 2015 14:13:48 -0400 Subject: [PATCH] Fix bug where page 0 is falsy and pagination would not be enabled. --- lib/transactions.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/transactions.js b/lib/transactions.js index fb1ed0599..b5a6fc635 100644 --- a/lib/transactions.js +++ b/lib/transactions.js @@ -1,6 +1,7 @@ 'use strict'; var bitcore = require('bitcore'); +var _ = bitcore.deps._; var common = require('./common'); var async = require('async'); @@ -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); @@ -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); } @@ -275,4 +276,4 @@ TxController.prototype.send = function(req, res) { }); }; -module.exports = TxController; \ No newline at end of file +module.exports = TxController;