Skip to content

Commit

Permalink
chore(p2p): Add some debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
renaynay committed Aug 1, 2023
1 parent d4042e0 commit d5f54af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions p2p/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func (ex *Exchange[H]) Head(ctx context.Context, opts ...header.HeadOption) (H,
default:
peers = trackedPeers
}
log.Debugw("requesting head from tracked peers", "amount", len(peers))
}

var (
Expand All @@ -154,15 +155,15 @@ func (ex *Exchange[H]) Head(ctx context.Context, opts ...header.HeadOption) (H,
go func(from peer.ID) {
headers, err := ex.request(reqCtx, from, headerReq)
if err != nil {
log.Errorw("head request to trusted peer failed", "trustedPeer", from, "err", err)
log.Errorw("head request to peer failed", "peer", from, "err", err)
headerRespCh <- zero
return
}
// if tracked (untrusted) peers were requested, verify head
if useTrackedPeers {
err = reqParams.TrustedHead.Verify(headers[0])
if err != nil {
log.Errorw("head request to untrusted peer failed", "untrusted peer", from,
log.Errorw("verifying head received from tracked peer", "tracked peer", from,
"err", err)
// bad head was given, block peer
ex.peerTracker.blockPeer(from, fmt.Errorf("returned bad head: %w", err))
Expand Down

0 comments on commit d5f54af

Please sign in to comment.