Repository navigation
Commit 8ab697f
Count only connected peers in /net_info n_peers (#4500)
`/net_info` builds `n_peers` from `Router.AllAddrs()`, which merges the
live connections with every address in the persistent and regular PEX
tables. On pacific-1 that reports roughly 175-200 "peers" on nodes that
are actually connected to around 45, which an operator running
`max-connections = 31` took for a broken peer cap. CometBFT tooling and
dashboards read `n_peers` as the connected-peer count. The known-peer
semantics come from the Tendermint v0.35 fork (`PeerManager.Peers()`
over the peer store); #2539 moved the source to the pool address maps,
and #3037 switched it to `AllAddrs()` while moving `peer_connections` to
live connections, which is why the two now disagree.
`Environment.NetInfo` now sets `n_peers` to the number of connected
peers, the same set as `peer_connections`. `peers` keeps listing every
known address, because the rpcnode init script and the sei-infra
state-sync and init scripts seed `persistent-peers` from `.peers[].url`.
Limiting it to connected peers left those lists empty whenever the
source node only had inbound peers without an `external-address`, which
is what made the Chain Operation Test time out in the merge queue.
Exposing the known-address count as a Prometheus metric is left to a
follow-up.
This is an RPC-only change with no consensus or state impact.
`TestNetInfo_NPeersCountsConnectedPeers` and
`TestNetInfo_PeersIncludesPexAddresses` both fail on main and pass here.
---------
Co-authored-by: alexander-sei <alexanderh@seinetwork.io>1 parent 85306c6 commit 8ab697f
2 files changed
Lines changed: 54 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | | - | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments