diff --git a/lib/mempool/mempool.js b/lib/mempool/mempool.js index dd77458a..f31776f4 100644 --- a/lib/mempool/mempool.js +++ b/lib/mempool/mempool.js @@ -77,8 +77,6 @@ function Mempool(options) { this.network = this.chain.network; this.logger = options.logger || this.chain.logger; - this.loaded = false; - this.locker = new Locker(true); this.size = 0; diff --git a/lib/net/peer.js b/lib/net/peer.js index 772fd01b..0e550c2a 100644 --- a/lib/net/peer.js +++ b/lib/net/peer.js @@ -79,8 +79,8 @@ function Peer(pool) { EventEmitter.call(this); this.pool = pool; - this.options = pool.options; - this.logger = pool.logger; + this.options = this.pool.options; + this.logger = this.pool.logger; this.chain = this.pool.chain; this.mempool = this.pool.mempool; this.network = this.chain.network; @@ -1303,7 +1303,7 @@ Peer.prototype.blockType = function blockType() { if (this.options.spv) return invTypes.FILTERED_BLOCK; - if (this.outbound) { + if (this.outbound && this.chain.synced) { if (this.options.compact && this.compactMode !== -1) { if (!this.options.witness || this.compactWitness) return invTypes.CMPCT_BLOCK; diff --git a/lib/net/pool.js b/lib/net/pool.js index 7927c80e..cff0b695 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -1696,7 +1696,7 @@ Pool.prototype.hasBlock = co(function* hasBlock(hash) { * Queue a `getdata` request to be sent. Checks existence * in the mempool before requesting. * @param {Peer} peer - * @param {Hash} hash - TX hash. + * @param {Hash[]} hashes * @returns {Boolean} */ @@ -1727,6 +1727,12 @@ Pool.prototype.getTX = function getTX(peer, hashes) { items.push(hash); } + this.logger.debug( + 'Requesting %d/%d txs from peer with getdata (%s).', + items.length, + this.requestMap.size, + peer.hostname); + peer.getTX(items); };