From b739db6a526fc0dbcc8ae4bcf37a060fc31c7423 Mon Sep 17 00:00:00 2001 From: Banana-J Date: Sun, 11 Feb 2024 20:31:48 +1100 Subject: [PATCH] fix: add a error log when author not found for the block that will be emitted to ethstats (#427) Co-authored-by: wjrjerome --- ethstats/ethstats.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go index dc67bea846..08d7410171 100644 --- a/ethstats/ethstats.go +++ b/ethstats/ethstats.go @@ -94,13 +94,14 @@ type Service struct { // websocket. // // From Gorilla websocket docs: -// Connections support one concurrent reader and one concurrent writer. -// Applications are responsible for ensuring that no more than one goroutine calls the write methods -// - NextWriter, SetWriteDeadline, WriteMessage, WriteJSON, EnableWriteCompression, SetCompressionLevel -// concurrently and that no more than one goroutine calls the read methods -// - NextReader, SetReadDeadline, ReadMessage, ReadJSON, SetPongHandler, SetPingHandler -// concurrently. -// The Close and WriteControl methods can be called concurrently with all other methods. +// +// Connections support one concurrent reader and one concurrent writer. +// Applications are responsible for ensuring that no more than one goroutine calls the write methods +// - NextWriter, SetWriteDeadline, WriteMessage, WriteJSON, EnableWriteCompression, SetCompressionLevel +// concurrently and that no more than one goroutine calls the read methods +// - NextReader, SetReadDeadline, ReadMessage, ReadJSON, SetPongHandler, SetPingHandler +// concurrently. +// The Close and WriteControl methods can be called concurrently with all other methods. type connWrapper struct { conn *websocket.Conn @@ -674,7 +675,10 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats { txs = []txStats{} } // Assemble and return the block stats - author, _ := s.engine.Author(header) + author, err := s.engine.Author(header) + if err != nil { + log.Error("Failed to retrieve block author", "err", err, "number", header.Number, "hash", header.Hash()) + } return &blockStats{ Number: header.Number,