From 7e38e4de7c35415d976ea555b14b9e8bc47bb712 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 26 May 2014 12:43:41 -0500 Subject: [PATCH] pool: change pool.options.satoshi to pool.options.relay. --- lib/bcoin/peer.js | 4 ++-- lib/bcoin/pool.js | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/bcoin/peer.js b/lib/bcoin/peer.js index 7bc7240e..cc36a162 100644 --- a/lib/bcoin/peer.js +++ b/lib/bcoin/peer.js @@ -161,7 +161,7 @@ Peer.prototype.broadcast = function broadcast(items) { }; Peer.prototype.updateWatch = function updateWatch() { - if (this.options.satoshi) { + if (!this.pool.options.relay) { if (this.ack) { var self = this; if (this.pool.block.lastHash) @@ -430,7 +430,7 @@ Peer.prototype._handleInv = function handleInv(items) { }); this.emit('blocks', blocks); - if (this.options.satoshi) { + if (!this.pool.options.relay) { if (txs.length) this.emit('txs', txs.map(function(tx) { return tx.hash; diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index f012700d..b41aa8e5 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -14,6 +14,7 @@ function Pool(options) { this.options = options || {}; this.storage = this.options.storage; + this.options.relay = this.options.relay !== false; this.destroyed = false; this.size = options.size || 32; this.parallel = options.parallel || 2000; @@ -105,8 +106,7 @@ Pool.prototype._addLoader = function _addLoader() { return; var peer = new bcoin.peer(this, this.createConnection, { - backoff: 750 * Math.random(), - satoshi: this.options.satoshi + backoff: 750 * Math.random() }); this.peers.load = peer; @@ -243,8 +243,7 @@ Pool.prototype._addPeer = function _addPeer(backoff) { return; var peer = new bcoin.peer(this, this.createConnection, { - backoff: backoff, - satoshi: this.options.satoshi + backoff: backoff }); this.peers.pending.push(peer); @@ -295,7 +294,7 @@ Pool.prototype._addPeer = function _addPeer(backoff) { self.emit('block', block, peer); }); - if (this.options.satoshi) { + if (!this.options.relay) { peer.on('block', function(block) { peer.emit('merkleblock', block); });