net: add --only option. fixes #210.

This commit is contained in:
Christopher Jeffrey 2017-05-12 12:02:55 -07:00
parent 87b5375079
commit a1d0948f2e
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 10 additions and 0 deletions

View File

@ -3976,6 +3976,14 @@ PoolOptions.prototype.fromOptions = function fromOptions(options) {
this.nodes = options.nodes;
}
if (options.only != null) {
assert(Array.isArray(options.only));
if (options.only.length > 0) {
this.nodes = options.only;
this.maxOutbound = options.only.length;
}
}
if (options.invTimeout != null) {
assert(typeof options.invTimeout === 'number');
this.invTimeout = options.invTimeout;

View File

@ -107,6 +107,7 @@ function FullNode(options) {
upnp: this.config.bool('upnp'),
seeds: this.config.array('seeds'),
nodes: this.config.array('nodes'),
only: this.config.array('only'),
publicHost: this.config.str('public-host'),
publicPort: this.config.num('public-port'),
host: this.config.str('host'),

View File

@ -67,6 +67,7 @@ function SPVNode(options) {
upnp: this.config.bool('upnp'),
seeds: this.config.array('seeds'),
nodes: this.config.array('nodes'),
only: this.config.array('only'),
bip151: this.config.bool('bip151'),
bip150: this.config.bool('bip150'),
identityKey: this.config.buf('identity-key'),