Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(p2p|sync): Only log head verification failure as error if it is not ErrKnownHeader #138

Merged
merged 5 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions p2p/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,14 @@ func (ex *Exchange[H]) Head(ctx context.Context, opts ...header.HeadOption[H]) (
headerRespCh <- headers[0]
return
}
log.Errorw("verifying head received from tracked peer", "tracked peer", from,
logF := log.Warnw
if errors.Is(err, header.ErrKnownHeader) {
logF = log.Debugw
}
logF("verifying head received from tracked peer", "tracked peer", from,
"height", headers[0].Height(), "err", err)
headerRespCh <- zero
return

}
}
// request ensures that the result slice will have at least one Header
Expand Down
6 changes: 5 additions & 1 deletion sync/sync_head.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ func (s *Syncer[H]) verify(ctx context.Context, newHead H) (bool, error) {

var verErr *header.VerifyError
if errors.As(err, &verErr) && !verErr.SoftFailure {
log.Errorw("invalid network header",
logF := log.Warnw
if errors.Is(err, header.ErrKnownHeader) {
logF = log.Debugw
}
logF("invalid network header",
"height_of_invalid", newHead.Height(),
"hash_of_invalid", newHead.Hash(),
"height_of_subjective", sbjHead.Height(),
Expand Down