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
This commit is contained in:
Sun Tae, Kim 2025-05-30 03:03:08 +09:00
parent 2a1784baef
commit 219e48390f

View file

@ -175,7 +175,10 @@ func (cv *ChainView) extendNonCanonical() bool {
} }
header := cv.chain.GetHeader(hash, number) header := cv.chain.GetHeader(hash, number)
if header == nil { 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 return false
} }
cv.hashes = append(cv.hashes, header.ParentHash) cv.hashes = append(cv.hashes, header.ParentHash)