From 7d4173049edc3b4ff2de1971c3ecca3b08588651 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Tue, 15 Aug 2023 03:07:03 -0400 Subject: [PATCH] Prevent destroyed providers from emitting network detection errors. --- src.ts/providers/provider-jsonrpc.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src.ts/providers/provider-jsonrpc.ts b/src.ts/providers/provider-jsonrpc.ts index cd88e5c4a1..4069ffb1e1 100644 --- a/src.ts/providers/provider-jsonrpc.ts +++ b/src.ts/providers/provider-jsonrpc.ts @@ -693,6 +693,7 @@ export abstract class JsonRpcApiProvider extends AbstractProvider { try { this.#network = await this._detectNetwork(); } catch (error) { + if (this.destroyed) { break; } console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"); this.emit("error", makeError("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error } })); await stall(1000);