Skip to content

Commit

Permalink
Do not send unsubscribe messages to destroyed Providers (#4678).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Apr 17, 2024
1 parent 38e32d8 commit c45935e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src.ts/providers/provider-socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src.ts/providers/subscriber-filterid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]);
});
}
Expand Down

0 comments on commit c45935e

Please sign in to comment.