Skip to content

Commit

Permalink
chore(header/p2p): improve logging (#1520)
Browse files Browse the repository at this point in the history
<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.
-->

## Overview
Change the logging level in the case when headers are not found in the
store.
## Checklist

<!-- 
Please complete the checklist to ensure that the PR is ready to be
reviewed.

IMPORTANT:
PRs should be left in Draft until the below checklist is completed.
-->

- [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
  • Loading branch information
vgonkivs authored Dec 21, 2022
1 parent ce63f62 commit 568b166
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions header/p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package p2p

import (
"context"
"errors"
"time"

"github.com/libp2p/go-libp2p-core/host"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 568b166

Please sign in to comment.