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.
This commit is contained in:
Braydon Fuller 2018-07-31 19:03:17 -07:00
parent d6c4aa215e
commit 7ea95b5795

View File

@ -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();