From fe9741fdf34d846772cfad13065bc5338b070936 Mon Sep 17 00:00:00 2001 From: sairajzero Date: Mon, 6 Feb 2023 01:54:41 +0530 Subject: [PATCH] fix --- lib/services/address/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/services/address/index.js b/lib/services/address/index.js index beec5337..d0899b8c 100644 --- a/lib/services/address/index.js +++ b/lib/services/address/index.js @@ -219,7 +219,7 @@ AddressService.prototype.getAddressHistory = function(addresses, options, stream results.items.unshift(tx); //using unshift, so that recent tx (low) are at front if(results.items.length > MAX_TX_QUERY_LIMIT) { //remove items from array when overflown - results.items.sort((a, b) => b.__height - a.__height || b.txid().localeCompare(a.txid())); + results.items.sort((a, b) => (b.__height || 0xffffffff) - (a.__height || 0xffffffff) || b.txid().localeCompare(a.txid())); let del_count = options.old_support ? results.items.length : results.items.length - MAX_TX_QUERY_LIMIT; let start_index = options.old_support ? MAX_TX_QUERY_LIMIT : 0; results.items.splice(start_index, del_count); @@ -239,7 +239,7 @@ AddressService.prototype.getAddressHistory = function(addresses, options, stream } //sort items in desc block-height, then asc txid (if same height) - results.items.sort((a, b) => b.__height - a.__height || b.txid().localeCompare(a.txid())); + results.items.sort((a, b) => (b.__height || 0xffffffff) - (a.__height || 0xffffffff) || b.txid().localeCompare(a.txid())); results.totalCount = parseInt(results.totalCount.toFixed()); //Quick support for `from` and `to` options (DEPRECATED! Not recommeded to use)