Fixed sorting and filtering problem.
This commit is contained in:
parent
b701ab31cf
commit
9bdd2aa86d
@ -76,8 +76,20 @@ AddressService.prototype.getAddressHistory = function(addresses, options, callba
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
options.txIdList = lodash.uniqWith(options.txIdList, lodash.isEqual);
|
var unique = {};
|
||||||
options.txIdList = lodash.orderBy(options.txIdList, ['height'], ['desc']);
|
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) {
|
self._getAddressTxHistory(options, function(err, txList) {
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,6 @@ DB.prototype.start = function(callback) {
|
|||||||
keyEncoding: 'binary',
|
keyEncoding: 'binary',
|
||||||
valueEncoding: 'binary',
|
valueEncoding: 'binary',
|
||||||
writeBufferSize: 8 * 1024 * 1024,
|
writeBufferSize: 8 * 1024 * 1024,
|
||||||
maxOpenFiles: 3000,
|
|
||||||
cacheSize: 1024 * 1024 * 1024 // 1 GB of memory for cache.
|
cacheSize: 1024 * 1024 * 1024 // 1 GB of memory for cache.
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -210,7 +210,6 @@ MempoolService.prototype._getAddressOperations = function(tx, reverse) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
MempoolService.prototype._onTransaction = function(tx) {
|
MempoolService.prototype._onTransaction = function(tx) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var ops = [{
|
var ops = [{
|
||||||
type: 'put',
|
type: 'put',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user