Skip to content

Commit

Permalink
Log warn when there are no goodpeers (#10344)
Browse files Browse the repository at this point in the history
When there are no goodpeers, log a different message in a WARN level, in
order to make the issue more evident as the node is not functional
without peers.

I've been suffering of no peers on sepolia (no idea of root cause yet)
recently and it took me some time + Daniel raising my attention to the
current log msg to figure it out.

if there are no good peers, the current log is a very innocuous info
with no count:

```
INFO[05-14|23:59:48.890] [p2p] GoodPeers
```
  • Loading branch information
wmitsuda authored May 15, 2024
1 parent 34455d3 commit 00bf861
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,14 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
peerCountMap[protocol] += count
}
}
for protocol, count := range peerCountMap {
logItems = append(logItems, eth.ProtocolToString[protocol], strconv.Itoa(count))
if len(peerCountMap) == 0 {
logger.Warn("[p2p] No GoodPeers")
} else {
for protocol, count := range peerCountMap {
logItems = append(logItems, eth.ProtocolToString[protocol], strconv.Itoa(count))
}
logger.Info("[p2p] GoodPeers", logItems...)
}
logger.Info("[p2p] GoodPeers", logItems...)
}
}
}()
Expand Down

0 comments on commit 00bf861

Please sign in to comment.