diff --git a/lib/services/bitcoind.js b/lib/services/bitcoind.js index 95bada78..4c70f910 100644 --- a/lib/services/bitcoind.js +++ b/lib/services/bitcoind.js @@ -130,7 +130,7 @@ Bitcoin.prototype._loadConfiguration = function() { ); $.checkState( - this.configuration.zmqpubhashtx, + this.configuration.zmqpubhashblock, '"zmqpubhashblock" option is required to get event updates from bitcoind. ' + 'Please add "zmqpubhashblock=tcp://127.0.0.1:" to your configuration and restart' ); @@ -632,7 +632,7 @@ Bitcoin.prototype.getAddressSummary = function(addressArg, options, callback) { * Will retrieve a block as a Node.js Buffer from disk. * @param {String|Number} block - A block hash or block height number */ -Bitcoin.prototype.getBlock = function(block, callback) { +Bitcoin.prototype.getBlock = function(blockArg, callback) { // TODO apply performance patch to the RPC method for raw data var self = this; @@ -641,20 +641,20 @@ Bitcoin.prototype.getBlock = function(block, callback) { if (err) { return callback(err); } - var blockCache = bitcore.Block.fromString(response.result); - self.blockCache.set(block, blockCache); - callback(null, blockCache); + var blockObj = bitcore.Block.fromString(response.result); + self.blockCache.set(blockArg, blockObj); + callback(null, blockObj); }); } - var cachedBlock = self.blockCache.get(block); + var cachedBlock = self.blockCache.get(blockArg); if (cachedBlock) { return setImmediate(function() { callback(null, cachedBlock); }); } else { - if (_.isNumber(block)) { - self.client.getBlockHash(block, function(err, response) { + if (_.isNumber(blockArg)) { + self.client.getBlockHash(blockArg, function(err, response) { if (err) { return callback(err); } @@ -662,7 +662,7 @@ Bitcoin.prototype.getBlock = function(block, callback) { queryBlock(blockhash); }); } else { - queryBlock(block); + queryBlock(blockArg); } }