From 9a1f1db523b7f767deb3013cd8102105f64d6141 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Tue, 7 Nov 2017 15:36:38 -0500 Subject: [PATCH] Fixed ordering of txs. --- lib/services/address/index.js | 8 ++++---- lib/services/mempool/index.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/services/address/index.js b/lib/services/address/index.js index c76ec1df..a580d4f5 100644 --- a/lib/services/address/index.js +++ b/lib/services/address/index.js @@ -76,15 +76,15 @@ AddressService.prototype.getAddressHistory = function(addresses, options, callba return callback(err); } - options.txIdList = lodash.uniqWith(lodash.flattenDeep(options.txIdList), lodash.isEqual); + options.txIdList = lodash.uniqWith(options.txIdList, lodash.isEqual); + options.txIdList = lodash.orderBy(options.txIdList, ['height'], ['desc']); + self._getAddressTxHistory(options, function(err, txList) { if (err) { return callback(err); } - txList = utils.orderByConfirmations(txList); - var results = { totalCount: options.txIdList.length || 0, items: txList @@ -397,7 +397,7 @@ AddressService.prototype._getAddressTxHistory = function(options, callback) { // go and get the actual txs async.mapLimit(ids, 4, function(id, next) { - if (id.height === -1) { + if (id.height === 0xffffffff) { return self._mempool.getMempoolTransaction(id.txid, function(err, tx) { if (err || !tx) { diff --git a/lib/services/mempool/index.js b/lib/services/mempool/index.js index 1e31beb6..077ef6a6 100644 --- a/lib/services/mempool/index.js +++ b/lib/services/mempool/index.js @@ -278,7 +278,7 @@ MempoolService.prototype.getTxidsByAddress = function(address, type, callback) { type = 0; } if (type === 'both' || type === addressInfo.input) { - results.push({ txid: addressInfo.txid, height: -1 }); + results.push({ txid: addressInfo.txid, height: 0xffffffff }); } });