eth/filters: replace atomic pointer with value (#26689)

* eth/filters: replace atomic.Pointer

* fix

* improve

Co-authored-by: Martin Holst Swende <martin@swende.se>

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
Sina Mahmoodi 2023-02-14 16:48:22 +03:00 committed by GitHub
parent f44ebc4838
commit ff38c9ee2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -95,7 +95,7 @@ func NewFilterSystem(backend Backend, config Config) *FilterSystem {
type logCacheElem struct {
logs []*types.Log
body atomic.Pointer[types.Body]
body atomic.Value
}
// 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, nil
return body.(*types.Body), nil
}
body, err := sys.backend.GetBody(ctx, hash, rpc.BlockNumber(number))
if err != nil {