eth: allow setting maxpeers dynamically

This commit is contained in:
Csaba Kiraly 2025-05-03 01:03:27 +02:00
parent 4644443b10
commit 2619478ae9
No known key found for this signature in database
GPG key ID: 0FE274EE8C95166E

View file

@ -410,6 +410,12 @@ func (s *Ethereum) Start() error {
return nil
}
func (s *Ethereum) setMaxPeers(max int) {
s.p2pServer.MaxPeers = max
s.handler.SetMaxPeers(max)
s.dropper.SetMaxPeers(s.p2pServer.MaxDialedConns(), s.p2pServer.MaxInboundConns())
}
func (s *Ethereum) newChainView(head *types.Header) *filtermaps.ChainView {
if head == nil {
return nil