From 62fb7d3f851aa8dda0b5abc7d761dd2fc7c499c2 Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi <1591639+s1na@users.noreply.github.com> Date: Thu, 30 Mar 2023 12:57:49 +0200 Subject: [PATCH] graphql: revert storage access regression (#27007) --- graphql/graphql.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/graphql/graphql.go b/graphql/graphql.go index 3c637d2d2..45a1f7a2a 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -81,26 +81,12 @@ type Account struct { r *Resolver address common.Address blockNrOrHash rpc.BlockNumberOrHash - state *state.StateDB - mu sync.Mutex } // getState fetches the StateDB object for an account. func (a *Account) getState(ctx context.Context) (*state.StateDB, error) { - a.mu.Lock() - defer a.mu.Unlock() - if a.state != nil { - return a.state, nil - } state, _, err := a.r.backend.StateAndHeaderByNumberOrHash(ctx, a.blockNrOrHash) - if err != nil { - return nil, err - } - a.state = state - // Cache the state object. This is done so that concurrent resolvers - // don't have to fetch the object from DB individually. - a.state.GetOrNewStateObject(a.address) - return a.state, nil + return state, err } func (a *Account) Address(ctx context.Context) (common.Address, error) {