From 8ad619219f8717d634c27109603436131798083c Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Sat, 14 Sep 2024 15:37:22 -0700 Subject: [PATCH] fix(zetaclient): add block by number result nil check (#2882) --- 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 {