diff --git a/lib/services/address/constants.js b/lib/services/address/constants.js index 84f9b32a..961f6e1f 100644 --- a/lib/services/address/constants.js +++ b/lib/services/address/constants.js @@ -49,6 +49,8 @@ exports.MAX_OUTPUTS_QUERY_LENGTH = 50000; exports.MAX_HISTORY_QUERY_LENGTH = 100; // The maximum number of addresses that can be queried at once exports.MAX_ADDRESSES_QUERY = 10000; +// The maximum number of simultaneous requests +exports.MAX_ADDRESSES_LIMIT = 50; module.exports = exports; diff --git a/lib/services/address/history.js b/lib/services/address/history.js index 1d707279..998dbfde 100644 --- a/lib/services/address/history.js +++ b/lib/services/address/history.js @@ -24,6 +24,7 @@ function AddressHistory(args) { this.maxHistoryQueryLength = args.options.maxHistoryQueryLength || constants.MAX_HISTORY_QUERY_LENGTH; this.maxAddressesQuery = args.options.maxAddressesQuery || constants.MAX_ADDRESSES_QUERY; + this.maxAddressesLimit = args.options.maxAddressesLimit || constants.MAX_ADDRESSES_LIMIT; this.addressStrings = []; for (var i = 0; i < this.addresses.length; i++) { @@ -89,8 +90,9 @@ AddressHistory.prototype.get = function(callback) { } else { var opts = _.clone(this.options); opts.fullTxList = true; - async.map( + async.mapLimit( self.addresses, + self.maxAddressesLimit, function(address, next) { self.node.services.address.getAddressSummary(address, opts, next); },