From 0bd03dbc5597175d79067270c0710604cba489cf Mon Sep 17 00:00:00 2001 From: cui <523516579@qq.com> Date: Tue, 2 Apr 2024 17:25:57 +0800 Subject: [PATCH] eth/filter: using atomic.Pointer instead of atomic.Value (#29435) --- eth/filters/filter_system.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/filters/filter_system.go b/eth/filters/filter_system.go index c32b837eb4..d8b41a4259 100644 --- a/eth/filters/filter_system.go +++ b/eth/filters/filter_system.go @@ -95,7 +95,7 @@ func NewFilterSystem(backend Backend, config Config) *FilterSystem { type logCacheElem struct { logs []*types.Log - body atomic.Value + body atomic.Pointer[types.Body] } // cachedLogElem loads block logs from the backend and caches the result. @@ -133,7 +133,7 @@ func (sys *FilterSystem) cachedLogElem(ctx context.Context, blockHash common.Has func (sys *FilterSystem) cachedGetBody(ctx context.Context, elem *logCacheElem, hash common.Hash, number uint64) (*types.Body, error) { if body := elem.body.Load(); body != nil { - return body.(*types.Body), nil + return body, nil } body, err := sys.backend.GetBody(ctx, hash, rpc.BlockNumber(number)) if err != nil {