Unverified Commit ff38c9ee authored by Sina Mahmoodi's avatar Sina Mahmoodi Committed by GitHub

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

* eth/filters: replace atomic.Pointer

* fix

* improve
Co-authored-by: 's avatarMartin Holst Swende <martin@swende.se>

---------
Co-authored-by: 's avatarMartin Holst Swende <martin@swende.se>
parent f44ebc48
...@@ -95,7 +95,7 @@ func NewFilterSystem(backend Backend, config Config) *FilterSystem { ...@@ -95,7 +95,7 @@ func NewFilterSystem(backend Backend, config Config) *FilterSystem {
type logCacheElem struct { type logCacheElem struct {
logs []*types.Log logs []*types.Log
body atomic.Pointer[types.Body] body atomic.Value
} }
// cachedLogElem loads block logs from the backend and caches the result. // 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 ...@@ -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) { func (sys *FilterSystem) cachedGetBody(ctx context.Context, elem *logCacheElem, hash common.Hash, number uint64) (*types.Body, error) {
if body := elem.body.Load(); body != nil { 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)) body, err := sys.backend.GetBody(ctx, hash, rpc.BlockNumber(number))
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment