p2p, eth: improve logs (#2123)

* p2p/discover: only show discovery status for bootnodes
* eth/downloader: uplevel expired request log
This commit is contained in:
Ng Wei Han 2024-01-08 16:32:06 +08:00 committed by GitHub
parent b2de32fb16
commit 7b22894146
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

@ -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)

@ -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
}
@ -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 (
@ -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 {