From 7f02c13607b297adf3a0b8c536425b4960477121 Mon Sep 17 00:00:00 2001 From: Matthieu Moquet Date: Wed, 18 Jan 2023 18:01:21 +0100 Subject: [PATCH] fix(eth): handle nil case on geth.BlockByNumber --- ethereum/execution/client/geth/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereum/execution/client/geth/client.go b/ethereum/execution/client/geth/client.go index 9e03c6d..fea013a 100644 --- a/ethereum/execution/client/geth/client.go +++ b/ethereum/execution/client/geth/client.go @@ -65,7 +65,7 @@ func (c *Client) ChainID(ctx context.Context) (*big.Int, error) { // finalizedBlock, err := s.core.ElClient().BlockByNumber(ctx, big.NewInt(int64(rpc.finalizedBlockNumber))) func (c *Client) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) { finalized := big.NewInt(int64(rpc.FinalizedBlockNumber)) - if number.Cmp(finalized) == 0 { + if number != nil && number.Cmp(finalized) == 0 { var raw json.RawMessage if err := c.rpcclient.CallContext(ctx, &raw, "eth_getBlockByNumber", "finalized", true); err != nil { return nil, err