use blocktime if present for sorting

This commit is contained in:
Matias Alejo Garcia 2015-10-28 18:36:48 -03:00
parent 038eb401db
commit 4662c2ecdc

View File

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