From 6726b055f3b187dd38729ce25ae02d5b97dab101 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Mon, 5 Jan 2026 12:32:37 -0500 Subject: [PATCH] fix: do not expose eth_close from the FilterAPI (#256) ## Why this should be merged Currently, `eth_close` is being registered as an available RPC due to `Close` being an exported function on the `FilterAPI`. ## How this works Converts the method to a function that takes in the API. ## How this was tested Updated unit test. --- eth/filters/api.libevm.go | 6 ++++-- eth/filters/api.libevm_test.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/eth/filters/api.libevm.go b/eth/filters/api.libevm.go index dff4f52ea6..71730188b4 100644 --- a/eth/filters/api.libevm.go +++ b/eth/filters/api.libevm.go @@ -16,7 +16,9 @@ package filters -// Close releases resources held by the API. -func (api *FilterAPI) Close() { +// CloseAPI releases resources held by the API. +// +// This is not implemented as a method to avoid exposing it via RPC. +func CloseAPI(api *FilterAPI) { close(api.quit) } diff --git a/eth/filters/api.libevm_test.go b/eth/filters/api.libevm_test.go index c18134ac01..a372c4405f 100644 --- a/eth/filters/api.libevm_test.go +++ b/eth/filters/api.libevm_test.go @@ -53,5 +53,5 @@ func TestClose(t *testing.T) { defer backend.Close() sys := NewFilterSystem(backend, Config{}) api := NewFilterAPI(sys, false) - api.Close() + CloseAPI(api) }