mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: add fixes
This commit is contained in:
parent
3d99858372
commit
139d94d9f7
1 changed files with 4 additions and 6 deletions
|
|
@ -336,14 +336,13 @@ func (f *clientPool) posExpiration(now mclock.AbsTime) fixed64 {
|
||||||
defer f.expLock.RUnlock()
|
defer f.expLock.RUnlock()
|
||||||
|
|
||||||
if f.posExpTC == 0 {
|
if f.posExpTC == 0 {
|
||||||
return 0
|
return f.posExp
|
||||||
}
|
}
|
||||||
dt := now - f.freeRatioLastUpdate
|
dt := now - f.freeRatioLastUpdate
|
||||||
if dt < 0 {
|
if dt < 0 {
|
||||||
dt = 0
|
dt = 0
|
||||||
}
|
}
|
||||||
dt /= mclock.AbsTime(time.Second)
|
return f.posExp + fixed64(float64(dt)*f.posExpTCi*f.freeRatio)
|
||||||
return f.posExp + fixed64(float64(dt)/float64(f.posExpTC)*f.freeRatio)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// negExpiration implements expirationController. Expiration happens only when
|
// negExpiration implements expirationController. Expiration happens only when
|
||||||
|
|
@ -353,14 +352,13 @@ func (f *clientPool) negExpiration(now mclock.AbsTime) fixed64 {
|
||||||
defer f.expLock.RUnlock()
|
defer f.expLock.RUnlock()
|
||||||
|
|
||||||
if f.negExpTC == 0 {
|
if f.negExpTC == 0 {
|
||||||
return 0
|
return f.negExp
|
||||||
}
|
}
|
||||||
dt := now - f.freeRatioLastUpdate
|
dt := now - f.freeRatioLastUpdate
|
||||||
if dt < 0 {
|
if dt < 0 {
|
||||||
dt = 0
|
dt = 0
|
||||||
}
|
}
|
||||||
dt /= mclock.AbsTime(time.Second)
|
return f.negExp + fixed64(float64(dt)*f.negExpTCi*f.freeRatio)
|
||||||
return f.negExp + fixed64(float64(dt)/float64(f.negExpTC)*f.freeRatio)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// totalTokenLimit returns the current token supply limit. Token prices are based
|
// totalTokenLimit returns the current token supply limit. Token prices are based
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue