diff --git a/lib/services/address/index.js b/lib/services/address/index.js index fde98884..f5da7307 100644 --- a/lib/services/address/index.js +++ b/lib/services/address/index.js @@ -50,7 +50,6 @@ AddressService.dependencies = [ // in are [addr1, addr2, addr3], then if addr3 has tx1 at height 10, addr2 has tx2 at height 9 and tx1 has no txs, // then I would pass back [tx1, tx2] in that order AddressService.prototype.getAddressHistory = function(addresses, options, callback) { - var self = this; options = options || {}; @@ -435,6 +434,8 @@ AddressService.prototype._getAddressTxidHistory = function(address, options, cal options.start = options.start || 0; options.end = options.end || 0xffffffff; + var results = []; + options.endHeightBuf = new Buffer(4); options.endHeightBuf.writeUInt32BE(options.end); @@ -461,7 +462,7 @@ AddressService.prototype._getAddressTxidHistory = function(address, options, cal return next(); } - options.txIdList = mempoolTxids; + results = mempoolTxids; next(); }, // stream the rest of the confirmed txids out of the address index @@ -480,12 +481,13 @@ AddressService.prototype._getAddressTxidHistory = function(address, options, cal }); txIdTransformStream.on('end', function() { + options.txIdList = options.txIdList.concat(results); next(); }); txIdTransformStream._transform = function(chunk, enc, callback) { var txInfo = self._encoding.decodeAddressIndexKey(chunk); - options.txIdList.push({ txid: txInfo.txid, height: txInfo.height }); + results.push({ txid: txInfo.txid, height: txInfo.height }); callback(); }; diff --git a/package-lock.json b/package-lock.json index 98748962..92a28a1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bitcore-node", - "version": "5.0.0-beta.37", + "version": "5.0.0-beta.39", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7b876209..bd2ae89c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "node": ">=8.0.0" }, "author": "BitPay ", - "version": "5.0.0-beta.37", + "version": "5.0.0-beta.39", "main": "./index.js", "repository": "git://github.com/bitpay/bitcore-node.git", "homepage": "https://github.com/bitpay/bitcore-node",