From 32d9d0c92120e50091d193971e024900b9848866 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 21 Jul 2016 15:41:29 -0300 Subject: [PATCH] add trim options and timeout --- lib/blockchainexplorers/insight.js | 5 ++++- lib/blockchainexplorers/request-list.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/blockchainexplorers/insight.js b/lib/blockchainexplorers/insight.js index 816f27d..ed0260c 100644 --- a/lib/blockchainexplorers/insight.js +++ b/lib/blockchainexplorers/insight.js @@ -104,7 +104,10 @@ Insight.prototype.getTransactions = function(addresses, from, to, cb) { method: 'POST', path: this.apiPrefix + '/addrs/txs' + (qs.length > 0 ? '?' + qs.join('&') : ''), json: { - addrs: [].concat(addresses).join(',') + addrs: [].concat(addresses).join(','), + noAsm: 1, + noScriptSig: 1, + noSpent: 1, }, }; diff --git a/lib/blockchainexplorers/request-list.js b/lib/blockchainexplorers/request-list.js index 90114ec..000f785 100644 --- a/lib/blockchainexplorers/request-list.js +++ b/lib/blockchainexplorers/request-list.js @@ -5,6 +5,8 @@ var $ = require('preconditions').singleton(); var log = require('npmlog'); log.debug = log.verbose; + +var DEFAULT_TIMEOUT= 50000; // 50 s /** * Query a server, using one of the given options * @@ -19,6 +21,8 @@ var requestList = function(args, cb) { if (!_.isArray(args.hosts)) args.hosts = [args.hosts]; + args.timeout = args.timeout || DEFAULT_TIMEOUT; + var urls = _.map(args.hosts, function(x) { return (x + args.path); });