Merge pull request #376 from braydonf/bug/block-txs-paging

Fix bug where page 0 is falsy and pagination would not be enabled.
This commit is contained in:
Chris Kleeschulte 2015-09-22 12:45:51 -04:00
commit 52b02eda14

View File

@ -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;
module.exports = TxController;