Skip to content

Commit 7d41730

Browse files
committed
Prevent destroyed providers from emitting network detection errors.
1 parent 30d3d6e commit 7d41730

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src.ts/providers/provider-jsonrpc.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ export abstract class JsonRpcApiProvider extends AbstractProvider {
693693
try {
694694
this.#network = await this._detectNetwork();
695695
} catch (error) {
696+
if (this.destroyed) { break; }
696697
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)");
697698
this.emit("error", makeError("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error } }));
698699
await stall(1000);

0 commit comments

Comments
 (0)