pool: change pool.options.satoshi to pool.options.relay.

This commit is contained in:
Christopher Jeffrey 2014-05-26 12:43:41 -05:00
parent a3b923ae76
commit 7e38e4de7c
2 changed files with 6 additions and 7 deletions

View File

@ -161,7 +161,7 @@ Peer.prototype.broadcast = function broadcast(items) {
}; };
Peer.prototype.updateWatch = function updateWatch() { Peer.prototype.updateWatch = function updateWatch() {
if (this.options.satoshi) { if (!this.pool.options.relay) {
if (this.ack) { if (this.ack) {
var self = this; var self = this;
if (this.pool.block.lastHash) if (this.pool.block.lastHash)
@ -430,7 +430,7 @@ Peer.prototype._handleInv = function handleInv(items) {
}); });
this.emit('blocks', blocks); this.emit('blocks', blocks);
if (this.options.satoshi) { if (!this.pool.options.relay) {
if (txs.length) if (txs.length)
this.emit('txs', txs.map(function(tx) { this.emit('txs', txs.map(function(tx) {
return tx.hash; return tx.hash;

View File

@ -14,6 +14,7 @@ function Pool(options) {
this.options = options || {}; this.options = options || {};
this.storage = this.options.storage; this.storage = this.options.storage;
this.options.relay = this.options.relay !== false;
this.destroyed = false; this.destroyed = false;
this.size = options.size || 32; this.size = options.size || 32;
this.parallel = options.parallel || 2000; this.parallel = options.parallel || 2000;
@ -105,8 +106,7 @@ Pool.prototype._addLoader = function _addLoader() {
return; return;
var peer = new bcoin.peer(this, this.createConnection, { var peer = new bcoin.peer(this, this.createConnection, {
backoff: 750 * Math.random(), backoff: 750 * Math.random()
satoshi: this.options.satoshi
}); });
this.peers.load = peer; this.peers.load = peer;
@ -243,8 +243,7 @@ Pool.prototype._addPeer = function _addPeer(backoff) {
return; return;
var peer = new bcoin.peer(this, this.createConnection, { var peer = new bcoin.peer(this, this.createConnection, {
backoff: backoff, backoff: backoff
satoshi: this.options.satoshi
}); });
this.peers.pending.push(peer); this.peers.pending.push(peer);
@ -295,7 +294,7 @@ Pool.prototype._addPeer = function _addPeer(backoff) {
self.emit('block', block, peer); self.emit('block', block, peer);
}); });
if (this.options.satoshi) { if (!this.options.relay) {
peer.on('block', function(block) { peer.on('block', function(block) {
peer.emit('merkleblock', block); peer.emit('merkleblock', block);
}); });