diff --git a/lib/net/pool.js b/lib/net/pool.js index 74c8d670..3786ca56 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -191,6 +191,10 @@ class Pool extends EventEmitter { async close() { assert(this.opened, 'Pool is not open.'); this.opened = false; + + for (const item of this.invMap.values()) + item.resolve(); + return this.disconnect(); } @@ -288,9 +292,6 @@ class Pool extends EventEmitter { this.disconnecting = true; - for (const item of this.invMap.values()) - item.resolve(); - this.peers.destroy(); this.blockMap.clear();