sort txs.

This commit is contained in:
Christopher Jeffrey 2016-04-09 03:56:36 -07:00
parent 096f71ba1a
commit 800d17278e
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 9 additions and 1 deletions

View File

@ -1339,7 +1339,7 @@ TXPool.prototype.getAll = function getAll(address, callback) {
if (err)
return callback(err);
return callback(null, txs);
return callback(null, utils.sortTX(txs));
});
});
};

View File

@ -754,6 +754,14 @@ utils.sortHDKeys = function sortHDKeys(keys) {
});
};
utils.sortTX = function sortTX(txs) {
return txs.slice().sort(function(a, b) {
a = a.ts || a.ps;
b = b.ts || b.ps;
return a - b;
});
};
utils.uniq = function uniq(obj) {
var out = [];
var i = 0;