diff --git a/lib/bcoin/fullnode.js b/lib/bcoin/fullnode.js index 3df54234..52af83cb 100644 --- a/lib/bcoin/fullnode.js +++ b/lib/bcoin/fullnode.js @@ -99,6 +99,8 @@ function Fullnode(options) { headers: this.options.headers, compact: this.options.compact, bip151: this.options.bip151, + maxPeers: this.options.maxPeers, + maxLeeches: this.options.maxLeeches, proxyServer: this.options.proxyServer, preferredSeed: this.options.preferredSeed, spv: false diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index 894ae916..4f561314 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -25,7 +25,7 @@ var InvItem = bcoin.packets.InvItem; * @param {Object} options * @param {Chain} options.chain * @param {Mempool?} options.mempool - * @param {Number?} [options.size=8] - Maximum number of peers. + * @param {Number?} [options.maxPeers=8] - Maximum number of peers. * @param {Boolean?} options.spv - Do an SPV sync. * @param {Boolean?} options.relay - Whether to ask * for relayed transactions. @@ -135,7 +135,7 @@ function Pool(options) { }); this.server = null; - this.size = options.size || 8; + this.maxPeers = options.maxPeers || 8; this.maxLeeches = options.maxLeeches || 8; this.connected = false; this.uid = 0; @@ -395,7 +395,7 @@ Pool.prototype.connect = function connect() { this._addLoader(); - for (i = 0; i < this.size - 1; i++) + for (i = 0; i < this.maxPeers - 1; i++) this._addPeer(); this.connected = true; @@ -1303,7 +1303,7 @@ Pool.prototype._addPeer = function _addPeer() { if (!this.loaded) return; - if (this.peers.regular.length + this.peers.pending.length >= this.size - 1) + if (this.peers.regular.length + this.peers.pending.length >= this.maxPeers - 1) return; host = this.getHost(); diff --git a/lib/bcoin/spvnode.js b/lib/bcoin/spvnode.js index fdbc10a9..7510b4f6 100644 --- a/lib/bcoin/spvnode.js +++ b/lib/bcoin/spvnode.js @@ -58,6 +58,7 @@ function SPVNode(options) { witness: this.network.witness, proxyServer: this.options.proxyServer, preferredSeed: this.options.preferredSeed, + maxPeers: this.options.maxPeers, selfish: true, listen: false, spv: true