From ccaa69e8e9af284743306d2a6932c18b18c2757a Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Sat, 13 Sep 2025 09:55:20 +0800 Subject: [PATCH] ethstats: overwrite old errors #21428 (#1444) Co-authored-by: Martin Holst Swende --- ethstats/ethstats.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ethstats/ethstats.go b/ethstats/ethstats.go index 147a171870..6e9e66c62d 100644 --- a/ethstats/ethstats.go +++ b/ethstats/ethstats.go @@ -308,11 +308,11 @@ func (s *Service) loop(chainHeadCh chan core.ChainHeadEvent, txEventCh chan core header.Set("origin", "http://localhost") for _, url := range urls { c, _, e := dialer.Dial(url, header) - if e == nil { + err = e + if err == nil { conn = newConnectionWrapper(c) break } - err = e } if err != nil { log.Warn("Stats server unreachable", "err", err) @@ -327,7 +327,6 @@ func (s *Service) loop(chainHeadCh chan core.ChainHeadEvent, txEventCh chan core continue } go s.readLoop(conn) - // Send the initial stats so our node looks decent from the get go if err = s.report(conn); err != nil { log.Warn("Initial stats report failed", "err", err)