Merge branch 'latest' into HEAD
This commit is contained in:
commit
84d1d01e59
|
@ -90,7 +90,7 @@ Insight.prototype._doRequest = function(args, cb) {
|
|||
var s = JSON.stringify(args);
|
||||
// if ( s.length > 100 )
|
||||
// s= s.substr(0,100) + '...';
|
||||
log.debug('', 'Insight Q: %s', s);
|
||||
// log.debug('', 'Insight Q: %s', s);
|
||||
|
||||
requestList(_.defaults(args, opts), cb);
|
||||
};
|
||||
|
@ -102,7 +102,7 @@ Insight.prototype.getConnectionInfo = function() {
|
|||
/**
|
||||
* Retrieve a list of unspent outputs associated with an address or set of addresses
|
||||
*/
|
||||
Insight.prototype.getUtxos = function(addresses, cb) {
|
||||
Insight.prototype.getUtxos = function(addresses, cb, walletId) {
|
||||
var self = this;
|
||||
|
||||
var url = this.url + this.apiPrefix + '/addrs/utxo';
|
||||
|
@ -112,6 +112,7 @@ Insight.prototype.getUtxos = function(addresses, cb) {
|
|||
json: {
|
||||
addrs: this.translateQueryAddresses(_.uniq([].concat(addresses))).join(',')
|
||||
},
|
||||
walletId: walletId, //only to report
|
||||
};
|
||||
|
||||
this.requestQueue.push(args, function(err, res, unspent) {
|
||||
|
@ -164,7 +165,7 @@ Insight.prototype.getTransaction = function(txid, cb) {
|
|||
});
|
||||
};
|
||||
|
||||
Insight.prototype.getTransactions = function(addresses, from, to, cb) {
|
||||
Insight.prototype.getTransactions = function(addresses, from, to, cb, walletId) {
|
||||
var self = this;
|
||||
|
||||
|
||||
|
@ -184,7 +185,8 @@ Insight.prototype.getTransactions = function(addresses, from, to, cb) {
|
|||
json: {
|
||||
addrs: this.translateQueryAddresses(_.uniq([].concat(addresses))).join(',')
|
||||
},
|
||||
timeout: 120000,
|
||||
timeout: Defaults.INSIGHT_TIMEOUT * 1.2 , // little extra time
|
||||
walletId: walletId, //only to report
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,12 @@ var $ = require('preconditions').singleton();
|
|||
var log = require('npmlog');
|
||||
log.debug = log.verbose;
|
||||
|
||||
var Common = require('../common');
|
||||
var Defaults = Common.Defaults;
|
||||
|
||||
|
||||
var DEFAULT_TIMEOUT= 60000; // 60 s
|
||||
|
||||
var DEFAULT_TIMEOUT= Defaults.INSIGHT_TIMEOUT;
|
||||
/**
|
||||
* Query a server, using one of the given options
|
||||
*
|
||||
|
@ -40,8 +44,8 @@ var requestList = function(args, cb) {
|
|||
|
||||
var time = 0;
|
||||
var interval = setInterval(function() {
|
||||
time += 10;
|
||||
log.debug('', 'Delayed insight query: %s, time: %d s', args.uri, time);
|
||||
time += 20;
|
||||
log.debug('', 'Delayed insight query: %s, time: %d, wallet: %s s', args.uri, time, args.walletId||'?');
|
||||
}, 10000);
|
||||
|
||||
request(args, function(err, res, body) {
|
||||
|
|
|
@ -136,5 +136,6 @@ Defaults.RateLimit = {
|
|||
};
|
||||
|
||||
Defaults.COIN = 'btc';
|
||||
Defaults.INSIGHT_REQUEST_POOL_SIZE = 20;
|
||||
Defaults.INSIGHT_REQUEST_POOL_SIZE = 10;
|
||||
Defaults.INSIGHT_TIMEOUT = 30000;
|
||||
module.exports = Defaults;
|
||||
|
|
|
@ -1146,7 +1146,7 @@ WalletService.prototype._getUtxos = function(coin, addresses, cb) {
|
|||
});
|
||||
|
||||
return cb(null, utxos);
|
||||
});
|
||||
}, self.walletId);
|
||||
};
|
||||
|
||||
WalletService.prototype._getUtxosForCurrentWallet = function(opts, cb) {
|
||||
|
@ -3198,7 +3198,7 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
|
|||
txs = self._normalizeTxHistory(rawTxs);
|
||||
totalItems = total;
|
||||
return next();
|
||||
});
|
||||
}, self.walletId);
|
||||
},
|
||||
function(next) {
|
||||
if (!useCache || fromCache) return next();
|
||||
|
|
Loading…
Reference in New Issue