diff --git a/lib/services/address/index.js b/lib/services/address/index.js index 3f6c6627..beec5337 100644 --- a/lib/services/address/index.js +++ b/lib/services/address/index.js @@ -218,11 +218,11 @@ AddressService.prototype.getAddressHistory = function(addresses, options, stream if(!results.items.some(x => x.txid() === tx.txid())) //push only if tx not already in array results.items.unshift(tx); //using unshift, so that recent tx (low) are at front - if(results.items.length > MAX_TX_QUERY_LIMIT) { + 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())); 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).map(r => r.txid()); + results.items.splice(start_index, del_count); } } @@ -848,11 +848,9 @@ AddressService.prototype._streamAddressSummary = function(address, options, stre //declare the queue to process tx data var tmpTxList = {}; //store processed txid temporarily to ignore duplication - let td_count = 0; //test var q = async.queue(function(id, cb) { - td_count++; //test - //duplication finding + //duplication finding if(id.txid in tmpTxList){ tmpTxList[id.txid][0]++; @@ -881,7 +879,7 @@ AddressService.prototype._streamAddressSummary = function(address, options, stre }, 4); - //q.pause(); //pause and wait until queue is set + //q.pause(); //pause and wait until queue is set (not needed) function chunkCallback(err, tx){ @@ -958,8 +956,7 @@ AddressService.prototype._streamAddressSummary = function(address, options, stre txIdTransformStream._transform = function(chunk, enc, cb) { - if(options.flag_stop){ - //stop data query + if(options.flag_stop){//stop data query console.debug("FLAG STOP:", options.flag_stop) return txIdTransformStream.unpipe(); }