Skip to content

Commit

Permalink
fixed elad
Browse files Browse the repository at this point in the history
  • Loading branch information
ranlavanet committed Sep 11, 2024
1 parent 11650ca commit 1dc01d6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions protocol/rpcprovider/rpcprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ func (rpcp *RPCProvider) SetupEndpoint(ctx context.Context, rpcProviderEndpoint
return utils.LavaFormatError("panic severity critical error, aborting support for chain api due to node access, continuing with other endpoints", err, utils.Attribute{Key: "chainTrackerConfig", Value: chainTrackerConfig}, utils.Attribute{Key: "endpoint", Value: rpcProviderEndpoint})
}

_, loaded, err = rpcp.chainTrackers.LoadOrStore(chainID, chainTracker)
chainTrackerLoaded, loaded, err := rpcp.chainTrackers.LoadOrStore(chainID, chainTracker)
if err != nil {
utils.LavaFormatFatal("failed to load or store chain tracker", err, utils.LogAttr("chainID", chainID))
}
Expand All @@ -445,10 +445,8 @@ func (rpcp *RPCProvider) SetupEndpoint(ctx context.Context, rpcProviderEndpoint
if err != nil {
return utils.LavaFormatError("failed to RegisterForSpecUpdates, panic severity critical error, aborting support for chain api due to invalid chain parser, continuing with others", err, utils.Attribute{Key: "endpoint", Value: rpcProviderEndpoint.String()})
}

// Any validation needs to be before we store chain tracker for given chain id
rpcp.chainTrackers.Store(rpcProviderEndpoint.ChainID, chainTracker)
} else {
} else { // loaded an existing chain tracker. use the same one instead
chainTracker = chainTrackerLoaded
utils.LavaFormatDebug("reusing chain tracker", utils.Attribute{Key: "chain", Value: rpcProviderEndpoint.ChainID})
}
return nil
Expand Down

0 comments on commit 1dc01d6

Please sign in to comment.