From 568b166304e38b5ad6e45146a15426119f120f45 Mon Sep 17 00:00:00 2001 From: Viacheslav Date: Wed, 21 Dec 2022 13:00:04 +0200 Subject: [PATCH] chore(header/p2p): improve logging (#1520) ## Overview Change the logging level in the case when headers are not found in the store. ## Checklist - [x] New and updated code has appropriate documentation - [x] New and updated code has new and/or updated testing - [x] Required CI checks are passing - [x] Visual proof for any user facing features like CLI or documentation updates - [x] Linked issues closed with keywords --- header/p2p/server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/header/p2p/server.go b/header/p2p/server.go index fbd7d8b119..b8ff06b380 100644 --- a/header/p2p/server.go +++ b/header/p2p/server.go @@ -2,6 +2,7 @@ package p2p import ( "context" + "errors" "time" "github.com/libp2p/go-libp2p-core/host" @@ -183,6 +184,10 @@ func (serv *ExchangeServer) handleRequest(from, to uint64) ([]*header.ExtendedHe defer cancel() headersByRange, err := serv.store.GetRangeByHeight(ctx, from, to) if err != nil { + if errors.Is(err, context.DeadlineExceeded) { + log.Warnw("server: requested headers not found", "from", from, "to", to) + return nil, header.ErrNotFound + } log.Errorw("server: getting headers", "from", from, "to", to, "err", err) return nil, err }