Compare commits

...

3 Commits

Author SHA1 Message Date
Matias Alejo Garcia
fa6555b16c Merge pull request #417 from matiu/bug/tx-sort
fix sort 2
2015-10-28 22:13:23 -03:00
Matias Alejo Garcia
36c2f5e1c5 fix sort 2 2015-10-28 22:10:00 -03:00
Matias Alejo Garcia
4662c2ecdc use blocktime if present for sorting 2015-10-28 18:36:48 -03:00

View File

@ -141,10 +141,11 @@ exports.multitxs = function(req, res, next) {
if (to < 0) to = 0;
if (from > nbTxs) from = nbTxs;
if (to > nbTxs) to = nbTxs;
var MAX = 9999999999;
txs.sort(function(a, b) {
var b = (b.firstSeenTs || b.ts)+ b.txid;
var a = (a.firstSeenTs || a.ts)+ a.txid;
var b = (b.ts || b.firstSeenTs || MAX) + b.txid;
var a = (a.ts || b.firstSeenTs || MAX) + a.txid;
if (a > b) return -1;
if (a < b) return 1;
return 0;