From 9a00622de4134136cc6612ab18e94f320f0d2735 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Tue, 7 Nov 2017 21:37:54 -0500 Subject: [PATCH 1/4] Fixed getAddressHistory. --- lib/services/address/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/services/address/index.js b/lib/services/address/index.js index a580d4f5..e65bbd93 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 || {}; @@ -78,7 +77,7 @@ AddressService.prototype.getAddressHistory = function(addresses, options, callba options.txIdList = lodash.uniqWith(options.txIdList, lodash.isEqual); options.txIdList = lodash.orderBy(options.txIdList, ['height'], ['desc']); - +console.log(options.txIdList); self._getAddressTxHistory(options, function(err, txList) { if (err) { @@ -423,6 +422,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); @@ -449,7 +450,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 @@ -468,12 +469,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(); }; From 749b962085555fb3ea6c9e0135745cd9b22c7d91 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Tue, 7 Nov 2017 21:40:24 -0500 Subject: [PATCH 2/4] Bumped version. --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 98748962..626bbb6b 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.38", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7b876209..8c7bcee6 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.38", "main": "./index.js", "repository": "git://github.com/bitpay/bitcore-node.git", "homepage": "https://github.com/bitpay/bitcore-node", From af23a8c6e2ff90c2ae4c8d17c38af85fba7eab32 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Wed, 8 Nov 2017 09:37:25 -0500 Subject: [PATCH 3/4] Removed console.log --- lib/services/address/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/services/address/index.js b/lib/services/address/index.js index e65bbd93..aede4a86 100644 --- a/lib/services/address/index.js +++ b/lib/services/address/index.js @@ -77,7 +77,6 @@ AddressService.prototype.getAddressHistory = function(addresses, options, callba options.txIdList = lodash.uniqWith(options.txIdList, lodash.isEqual); options.txIdList = lodash.orderBy(options.txIdList, ['height'], ['desc']); -console.log(options.txIdList); self._getAddressTxHistory(options, function(err, txList) { if (err) { From ab2163ffdd4800132c04dc411958b9095707cb49 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Wed, 8 Nov 2017 09:38:58 -0500 Subject: [PATCH 4/4] Bumped version. --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 626bbb6b..92a28a1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bitcore-node", - "version": "5.0.0-beta.38", + "version": "5.0.0-beta.39", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8c7bcee6..bd2ae89c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "node": ">=8.0.0" }, "author": "BitPay ", - "version": "5.0.0-beta.38", + "version": "5.0.0-beta.39", "main": "./index.js", "repository": "git://github.com/bitpay/bitcore-node.git", "homepage": "https://github.com/bitpay/bitcore-node",