From 7ea95b5795224a24f182f02cc3a4db6079b0ebdc Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Tue, 31 Jul 2018 19:03:17 -0700 Subject: [PATCH] net: revolve pending broadcast items If `pool.close()` is called if the pool is not connected, timers won't be cleared. Transactions can be added to the pool while it's not connected. --- lib/net/pool.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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();