pool: disable discover with only

This commit is contained in:
Javed Khan 2019-01-31 20:27:47 +05:30
parent 7f736db0d7
commit 127fea663f
No known key found for this signature in database
GPG Key ID: 7E31745B904584E6

View File

@ -462,6 +462,9 @@ class Pool extends EventEmitter {
*/
async discoverSeeds(checkPeers) {
if (!this.discover)
return;
if (this.hosts.dnsSeeds.length === 0)
return;
@ -3548,6 +3551,7 @@ class PoolOptions {
this.services = common.LOCAL_SERVICES;
this.requiredServices = common.REQUIRED_SERVICES;
this.memory = true;
this.discover = true;
this.fromOptions(options);
}
@ -3735,9 +3739,15 @@ class PoolOptions {
if (options.only.length > 0) {
this.nodes = options.only;
this.maxOutbound = options.only.length;
this.discover = false;
}
}
if (options.discover != null) {
assert(typeof options.discover === 'boolean');
this.discover = options.discover;
}
if (options.invTimeout != null) {
assert(typeof options.invTimeout === 'number');
this.invTimeout = options.invTimeout;