diff --git a/les/api.go b/les/api.go index 104fc5abc4..19e5bdf096 100644 --- a/les/api.go +++ b/les/api.go @@ -59,7 +59,8 @@ func NewPrivateLightServerAPI(server *LesServer) *PrivateLightServerAPI { // ServerInfo returns global server parameters func (api *PrivateLightServerAPI) ServerInfo() map[string]interface{} { res := make(map[string]interface{}) - res["minimumCapacity"] = uint64(api.server.minCapacity) + res["minimumCapacity"] = api.server.minCapacity + res["maximumCapacity"] = api.server.maxCapacity res["freeClientCapacity"] = api.server.freeClientCap res["totalCapacity"], res["totalConnectedCapacity"], res["priorityConnectedCapacity"], res["totalPriorityCapacity"] = api.server.priorityClientPool.capacityInfo() return res diff --git a/les/server.go b/les/server.go index 4ac0b2a6d6..f8e995c1a2 100644 --- a/les/server.go +++ b/les/server.go @@ -65,10 +65,10 @@ type LesServer struct { thcNormal, thcBlockProcessing int // serving thread count for normal operation and block processing mode - maxPeers int - minCapacity, freeClientCap uint64 - freeClientPool *freeClientPool - priorityClientPool *priorityClientPool + maxPeers int + minCapacity, maxCapacity, freeClientCap uint64 + freeClientPool *freeClientPool + priorityClientPool *priorityClientPool } func NewLesServer(e *eth.Ethereum, config *eth.Config) (*LesServer, error) { @@ -236,11 +236,11 @@ func (s *LesServer) Start(srvr *p2p.Server) { } } - maxCapacity := s.freeClientCap * uint64(s.maxPeers) - if totalRecharge > maxCapacity { - maxCapacity = totalRecharge + s.maxCapacity = s.freeClientCap * uint64(s.maxPeers) + if totalRecharge > s.maxCapacity { + s.maxCapacity = totalRecharge } - s.fcManager.SetCapacityLimits(s.freeClientCap, maxCapacity, s.freeClientCap*2) + s.fcManager.SetCapacityLimits(s.freeClientCap, s.maxCapacity, s.freeClientCap*2) poolMetricsLogger := s.csvLogger if !logClientPoolMetrics { poolMetricsLogger = nil