mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: fix unit tests
This commit is contained in:
parent
e7daae4d0a
commit
58e19dc15d
2 changed files with 3 additions and 5 deletions
|
|
@ -169,10 +169,7 @@ func newClientPool(db ethdb.Database, freeClientCap uint64, clock mclock.Clock,
|
|||
// delete this entry.
|
||||
ndb.nbEvictCallBack = func(now mclock.AbsTime, b negBalance) bool {
|
||||
balance := math.Exp(float64(b.logValue-pool.logOffset(now)) / fixedPointMultiplier)
|
||||
if balance <= 1 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return balance <= 1
|
||||
}
|
||||
go func() {
|
||||
for {
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ func TestFreeClientKickedOut(t *testing.T) {
|
|||
|
||||
for i := 0; i < 10; i++ {
|
||||
pool.connect(poolTestPeer(i), 1)
|
||||
clock.Run(time.Millisecond)
|
||||
clock.Run(100 * time.Millisecond)
|
||||
}
|
||||
if pool.connect(poolTestPeer(11), 1) {
|
||||
t.Fatalf("New free client should be rejected")
|
||||
|
|
@ -498,6 +498,7 @@ func TestNodeDBExpiration(t *testing.T) {
|
|||
for _, c := range cases {
|
||||
ndb.setNB(c.ip, c.balance)
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond) // Ensure the db expirer is registered.
|
||||
clock.Run(time.Hour + time.Minute)
|
||||
select {
|
||||
case <-done:
|
||||
|
|
|
|||
Loading…
Reference in a new issue