From 801aa1bdf7a51536996d02c90c0defb84a5d4edf Mon Sep 17 00:00:00 2001 From: Giulio rebuffo Date: Sun, 1 Sep 2024 16:50:40 +0200 Subject: [PATCH] Cherry-pick: Nil-Ptr in `CurrentHeader` (#11807) --- turbo/execution/eth1/getters.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/turbo/execution/eth1/getters.go b/turbo/execution/eth1/getters.go index 7c94b1e6bca..877a1c53a32 100644 --- a/turbo/execution/eth1/getters.go +++ b/turbo/execution/eth1/getters.go @@ -259,6 +259,9 @@ func (e *EthereumExecutionModule) CurrentHeader(ctx context.Context, _ *emptypb. defer tx.Rollback() hash := rawdb.ReadHeadHeaderHash(tx) number := rawdb.ReadHeaderNumber(tx, hash) + if number == nil { + return nil, errors.New("ethereumExecutionModule.CurrentHeader: no current header yet - probabably node not synced yet") + } h, err := e.blockReader.Header(ctx, tx, hash, *number) if err != nil { return nil, fmt.Errorf("ethereumExecutionModule.CurrentHeader: blockReader.Header error %w", err)