Do not send unsubscribe messages to destroyed Providers (#4678).

This commit is contained in:
Richard Moore 2024-04-16 21:32:34 -04:00
parent 38e32d8214
commit c45935e29c
2 changed files with 2 additions and 0 deletions

@ -69,6 +69,7 @@ export class SocketSubscriber implements Subscriber {
stop(): void {
(<Promise<number>>(this.#filterId)).then((filterId) => {
if (this.#provider.destroyed) { return; }
this.#provider.send("eth_unsubscribe", [ filterId ]);
});
this.#filterId = null;

@ -118,6 +118,7 @@ export class FilterIdSubscriber implements Subscriber {
if (filterIdPromise) {
this.#filterIdPromise = null;
filterIdPromise.then((filterId) => {
if (this.#provider.destroyed) { return; }
this.#provider.send("eth_uninstallFilter", [ filterId ]);
});
}