Skip to content

Commit

Permalink
p2p, eth: improve logs (bnb-chain#2123)
Browse files Browse the repository at this point in the history
* p2p/discover: only show discovery status for bootnodes
* eth/downloader: uplevel expired request log
  • Loading branch information
weiihann authored and VM committed Jan 22, 2024
1 parent 60ef446 commit 3cde0e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion eth/downloader/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ func (q *queue) expire(peer string, pendPool map[string]*fetchRequest, taskQueue
// as there's no order of events that should lead to such expirations.
req := pendPool[peer]
if req == nil {
log.Error("Expired request does not exist", "peer", peer)
log.Trace("Expired request does not exist", "peer", peer)
return 0
}
delete(pendPool, peer)
Expand Down
8 changes: 5 additions & 3 deletions p2p/discover/v4_udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func ListenV4(c UDPConn, ln *enode.LocalNode, cfg Config) (*UDPv4, error) {
go tab.loop()

t.wg.Add(2)
go t.loop()
go t.loop(cfg.IsBootnode)
go t.readLoop(cfg.Unhandled)
return t, nil
}
Expand Down Expand Up @@ -405,7 +405,7 @@ func (t *UDPv4) handleReply(from enode.ID, fromIP net.IP, req v4wire.Packet) boo

// loop runs in its own goroutine. it keeps track of
// the refresh timer and the pending reply queue.
func (t *UDPv4) loop() {
func (t *UDPv4) loop(isBootNode bool) {
defer t.wg.Done()

var (
Expand Down Expand Up @@ -442,7 +442,9 @@ func (t *UDPv4) loop() {
}

logStatistic := func() {
t.log.Info("Current status", "table_size", t.tab.len(), "pending_size", plist.Len(), "db_size", t.db.Size())
if isBootNode {
t.log.Info("Discovery status", "table_size", t.tab.len(), "pending_size", plist.Len(), "db_size", t.db.Size())
}
}

for {
Expand Down

0 comments on commit 3cde0e0

Please sign in to comment.