Fixed sorting and filtering problem.

This commit is contained in:
Chris Kleeschulte 2017-11-08 19:01:13 -05:00
parent b701ab31cf
commit 9bdd2aa86d
No known key found for this signature in database
GPG Key ID: 33195D27EF6BDB7F
3 changed files with 14 additions and 4 deletions

View File

@ -76,8 +76,20 @@ AddressService.prototype.getAddressHistory = function(addresses, options, callba
return callback(err);
}
options.txIdList = lodash.uniqWith(options.txIdList, lodash.isEqual);
options.txIdList = lodash.orderBy(options.txIdList, ['height'], ['desc']);
var unique = {};
var list = [];
for (let i = 0; i < options.txIdList.length; i++) {
unique[options.txIdList[i].txid + options.txIdList[i].height] = options.txIdList[i];
}
for (var prop in unique) {
list.push(unique[prop]);
}
options.txIdList = list.sort(function(a, b) {
return b.height - a.height;
});
self._getAddressTxHistory(options, function(err, txList) {

View File

@ -82,7 +82,6 @@ DB.prototype.start = function(callback) {
keyEncoding: 'binary',
valueEncoding: 'binary',
writeBufferSize: 8 * 1024 * 1024,
maxOpenFiles: 3000,
cacheSize: 1024 * 1024 * 1024 // 1 GB of memory for cache.
});

View File

@ -210,7 +210,6 @@ MempoolService.prototype._getAddressOperations = function(tx, reverse) {
};
MempoolService.prototype._onTransaction = function(tx) {
var self = this;
var ops = [{
type: 'put',