diff --git a/lib/services/address/index.js b/lib/services/address/index.js index 27e6f3c6..16696785 100644 --- a/lib/services/address/index.js +++ b/lib/services/address/index.js @@ -180,7 +180,7 @@ AddressService.prototype.getAddressHistory = function(addresses, options, stream options.from = options.from || 0; options.to = options.to || 0xffffffff; - if(!callback){ //if only 3 args, then streamer is callback + if(typeof callback !== 'function'){ //if only 3 args, then streamer is callback callback = streamer; streamer = () => null; //NULL fn } @@ -285,7 +285,7 @@ AddressService.prototype.getAddressSummary = function(address, options, streamer options.queryMempool = true; } - if(!callback){ //if only 3 args, then streamer is callback + if(typeof callback !== 'function'){ //if only 3 args, then streamer is callback callback = streamer; streamer = () => null; //NULL fn } @@ -786,15 +786,14 @@ AddressService.prototype._streamAddressSummary = function(address, options, stre }); txIdTransformStream.on('end', function() { - q.drain = (e, d) => { - console.debug("Q-DRAIN", e, d) - next(); - }; + q.drain = next; + console.debug(q.drain); q.resume(); }); txIdTransformStream._transform = function(chunk, enc, cb) { var txInfo = self._encoding.decodeAddressIndexKey(chunk); + self._db.get(chunk, (err, data) => console.debug(data)); //test-check q.push({ txid: txInfo.txid, height: txInfo.height }, process_chunk); cb();