les, tests: fix les clientpool (#22756)

* les, tests: fix les clientpool

* tests: disable debug mode

* les: polish code
This commit is contained in:
gary rong
2021-04-28 20:18:25 +08:00
committed by GitHub
parent 9e5bb84c0e
commit 6d7c9566df
3 changed files with 67 additions and 19 deletions

View File

@ -239,12 +239,11 @@ func (cp *ClientPool) SetCapacity(node *enode.Node, reqCap uint64, bias time.Dur
maxTarget = curve.maxCapacity(func(capacity uint64) int64 {
return balance.estimatePriority(capacity, 0, 0, bias, false)
})
if maxTarget <= capacity {
if maxTarget < reqCap {
return
}
if maxTarget > reqCap {
maxTarget = reqCap
}
maxTarget = reqCap
// Specify a narrow target range that allows a limited number of fine step
// iterations
minTarget = maxTarget - maxTarget/20