From 78870fc56eccd564b024dd2daa11489ba451115d Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Fri, 25 Mar 2016 16:51:47 -0400 Subject: [PATCH] fixed bug that was removing transactions from the cached block --- lib/transactions.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/transactions.js b/lib/transactions.js index 87bf352..dbcf5a1 100644 --- a/lib/transactions.js +++ b/lib/transactions.js @@ -270,12 +270,15 @@ TxController.prototype.list = function(req, res) { } self.node.services.bitcoind.getBlockHeader(block.hash, function(err, blockInfo) { - var txs = block.transactions; - var totalTxs = txs.length; + var totalTxs = block.transactions.length; + var txs; if(!_.isUndefined(page)) { - txs = txs.splice(page * pageLength, pageLength); + var start = page * pageLength; + txs = block.transactions.slice(start, start + pageLength); pagesTotal = Math.ceil(totalTxs / pageLength); + } else { + txs = block.transactions; } async.mapSeries(txs, function(tx, next) {