From 219e48390fcdfc55ea5dfd1fb92b5ee5da35af64 Mon Sep 17 00:00:00 2001 From: "Sun Tae, Kim" <38067691+humblefirm@users.noreply.github.com> Date: Fri, 30 May 2025 03:03:08 +0900 Subject: [PATCH] fix(filtermaps): reduce log noise from header not found after debug_setHead When debug_setHead removes blocks from the blockchain, the log indexer's ChainView may still reference these deleted blocks. This causes repeated ERROR logs when extendNonCanonical() tries to access missing headers. This change improves the user experience by: - Changing log level from ERROR to DEBUG to reduce noise - Adding descriptive context about the chain view extension operation - Maintaining existing error handling behavior (return false) The underlying functionality remains unchanged - this is purely a logging improvement to prevent spurious error messages that could mask real issues. Fixes #31929 --- core/filtermaps/chain_view.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/filtermaps/chain_view.go b/core/filtermaps/chain_view.go index 433ca07cd0..305ff179e2 100644 --- a/core/filtermaps/chain_view.go +++ b/core/filtermaps/chain_view.go @@ -175,7 +175,10 @@ func (cv *ChainView) extendNonCanonical() bool { } header := cv.chain.GetHeader(hash, number) if header == nil { - log.Error("Header not found", "number", number, "hash", hash) + // Header not found - this can happen after debug_setHead operations + // where blocks have been deleted. Return false to indicate the chain view + // is no longer valid rather than logging repeated errors. + log.Debug("Header not found during chain view extension", "number", number, "hash", hash) return false } cv.hashes = append(cv.hashes, header.ParentHash)