mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-22 07:49:26 +00:00
eth/filter: using atomic.Pointer instead of atomic.Value (#29435)
This commit is contained in:
parent
e63f992fed
commit
0bd03dbc55
1 changed files with 2 additions and 2 deletions
|
|
@ -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.Value
|
body atomic.Pointer[types.Body]
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|
||||||
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.(*types.Body), nil
|
return 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 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue