@@ -111,15 +111,6 @@ func FetchGethConfig(rpcURL string, logger tmlog.Logger) (*GethConfig, error) {
111111 return config , nil
112112}
113113
114- // fetchMPTForkTime fetches the MPT fork time from geth via eth_config API (internal)
115- func fetchMPTForkTime (rpcURL string , logger tmlog.Logger ) (uint64 , error ) {
116- config , err := FetchGethConfig (rpcURL , logger )
117- if err != nil {
118- return 0 , err
119- }
120- return config .SwitchTime , nil
121- }
122-
123114type RetryableClient struct {
124115 authClient * authclient.Client // current geth
125116 ethClient * ethclient.Client // current geth
@@ -131,22 +122,16 @@ type RetryableClient struct {
131122 logger tmlog.Logger
132123}
133124
134- // NewRetryableClient creates a new retryable client that fetches switch time from geth.
135- // The l2EthAddr is used to fetch the switch time via eth_config API.
125+ // NewRetryableClient creates a new retryable client with the given switch time.
136126// Will retry calling the api, if the connection is refused.
137127//
138128// If nextAuthClient or nextEthClient is nil, switch is disabled and only current client is used.
139129// This is useful for nodes that don't need to switch geth (most nodes).
140- func NewRetryableClient (authClient * authclient.Client , ethClient * ethclient.Client , nextAuthClient * authclient.Client , nextEthClient * ethclient.Client , l2EthAddr string , logger tmlog.Logger ) * RetryableClient {
130+ //
131+ // The switchTime should be fetched via FetchGethConfig before calling this function.
132+ func NewRetryableClient (authClient * authclient.Client , ethClient * ethclient.Client , nextAuthClient * authclient.Client , nextEthClient * ethclient.Client , switchTime uint64 , logger tmlog.Logger ) * RetryableClient {
141133 logger = logger .With ("module" , "retryClient" )
142134
143- // Fetch switch time from geth
144- switchTime , err := fetchMPTForkTime (l2EthAddr , logger )
145- if err != nil {
146- logger .Error ("Failed to fetch switch time from geth, using 0" , "error" , err )
147- switchTime = 0
148- }
149-
150135 // If next client is not configured, disable switch
151136 if nextAuthClient == nil || nextEthClient == nil {
152137 logger .Info ("L2Next client not configured, switch disabled" )
0 commit comments