From 1c6b221c426bd68891c641235b9c42d1de739c43 Mon Sep 17 00:00:00 2001 From: Matt Ketmo Date: Thu, 18 Jan 2024 17:28:59 +0100 Subject: [PATCH] fix: potential panic when rpc doesn't return block (#56) Close #52 --- pkg/rpc/node.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/rpc/node.go b/pkg/rpc/node.go index 596538e..0dfc8be 100644 --- a/pkg/rpc/node.go +++ b/pkg/rpc/node.go @@ -262,6 +262,10 @@ func (n *Node) syncBlocks(ctx context.Context) { } currentBlock := currentBlockResp.Block + if currentBlock == nil { + log.Error().Err(err).Msgf("no block returned when requesting latest block") + return + } // Check the latest known block height latestBlockHeight := int64(0)