diff --git a/lib/bcoin/peer.js b/lib/bcoin/peer.js index e6770e75..a30d8ea5 100644 --- a/lib/bcoin/peer.js +++ b/lib/bcoin/peer.js @@ -161,6 +161,7 @@ Peer.prototype.broadcast = function broadcast(items) { }; Peer.prototype.updateWatch = function updateWatch() { + if (this.options.satoshi) return; if (this.ack) this._write(this.framer.filterLoad(this.bloom, 'none')); }; @@ -417,6 +418,13 @@ Peer.prototype._handleInv = function handleInv(items) { }); this.emit('blocks', blocks); + if (this.options.satoshi) { + this.getData(items.filter(function(item) { + return item.type === 'block'; + })); + return; + } + if (txs.length === 0) return; diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index 39757250..ab26a657 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -105,7 +105,8 @@ Pool.prototype._addLoader = function _addLoader() { return; var peer = new bcoin.peer(this, this.createConnection, { - backoff: 750 * Math.random() + backoff: 750 * Math.random(), + satoshi: this.options.satoshi }); this.peers.load = peer; @@ -242,7 +243,8 @@ Pool.prototype._addPeer = function _addPeer(backoff) { return; var peer = new bcoin.peer(this, this.createConnection, { - backoff: backoff + backoff: backoff, + satoshi: this.options.satoshi }); this.peers.pending.push(peer); @@ -293,9 +295,11 @@ Pool.prototype._addPeer = function _addPeer(backoff) { self.emit('block', block, peer); }); - peer.on('block', function(block) { - self.emit('block', block, peer); - }); + if (this.options.satoshi) { + peer.on('block', function(block) { + self.emit('block', block, peer); + }); + } // Just FYI peer.on('reject', function(payload) {