From 86344f667bd15b6ae301f3c319db99a24282d2b4 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Fri, 13 Sep 2024 18:41:04 -0700 Subject: [PATCH] fix(zetaclient): add block by number result nil check --- zetaclient/chains/evm/observer/observer.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zetaclient/chains/evm/observer/observer.go b/zetaclient/chains/evm/observer/observer.go index c10ecbc54f..39de0eedea 100644 --- a/zetaclient/chains/evm/observer/observer.go +++ b/zetaclient/chains/evm/observer/observer.go @@ -315,6 +315,9 @@ func (ob *Observer) BlockByNumber(blockNumber int) (*ethrpc.Block, error) { if err != nil { return nil, err } + if block == nil { + return nil, fmt.Errorf("block not found: %d", blockNumber) + } for i := range block.Transactions { err := evm.ValidateEvmTransaction(&block.Transactions[i]) if err != nil {