mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: fix lint
This commit is contained in:
parent
2351fdf9aa
commit
e7daae4d0a
2 changed files with 11 additions and 11 deletions
|
|
@ -181,13 +181,13 @@ func TestEstimatedPriority(t *testing.T) {
|
||||||
|
|
||||||
// 3 seconds time cost, 3 second estimated time cost, 10^9*2 request cost,
|
// 3 seconds time cost, 3 second estimated time cost, 10^9*2 request cost,
|
||||||
// 4*10^9 estimated request cost.
|
// 4*10^9 estimated request cost.
|
||||||
{time.Second, 3*time.Second, 1000000000, ^int64(48)},
|
{time.Second, 3 * time.Second, 1000000000, ^int64(48)},
|
||||||
|
|
||||||
// All positive balance is used up
|
// All positive balance is used up
|
||||||
{time.Second*55, 0, 0, 0},
|
{time.Second * 55, 0, 0, 0},
|
||||||
|
|
||||||
// 1 minute estimated time cost, 4/58 * 10^9 estimated request cost per sec.
|
// 1 minute estimated time cost, 4/58 * 10^9 estimated request cost per sec.
|
||||||
{0, time.Minute, 0, int64(time.Minute) + int64(time.Second) * 120/29},
|
{0, time.Minute, 0, int64(time.Minute) + int64(time.Second)*120/29},
|
||||||
}
|
}
|
||||||
for _, i := range inputs {
|
for _, i := range inputs {
|
||||||
clock.Run(i.runTime)
|
clock.Run(i.runTime)
|
||||||
|
|
@ -209,13 +209,13 @@ func TestCallbackChecking(t *testing.T) {
|
||||||
tracker.setFactors(false, 1, 1)
|
tracker.setFactors(false, 1, 1)
|
||||||
tracker.setFactors(true, 1, 1)
|
tracker.setFactors(true, 1, 1)
|
||||||
|
|
||||||
var inputs = []struct{
|
var inputs = []struct {
|
||||||
priority int64
|
priority int64
|
||||||
expDiff time.Duration
|
expDiff time.Duration
|
||||||
} {
|
}{
|
||||||
{^int64(500), time.Millisecond*500},
|
{^int64(500), time.Millisecond * 500},
|
||||||
{0, time.Second},
|
{0, time.Second},
|
||||||
{int64(time.Second), 2*time.Second},
|
{int64(time.Second), 2 * time.Second},
|
||||||
}
|
}
|
||||||
tracker.setBalance(uint64(time.Second), 0)
|
tracker.setBalance(uint64(time.Second), 0)
|
||||||
for _, i := range inputs {
|
for _, i := range inputs {
|
||||||
|
|
@ -238,7 +238,7 @@ func TestCallback(t *testing.T) {
|
||||||
|
|
||||||
callCh := make(chan struct{}, 1)
|
callCh := make(chan struct{}, 1)
|
||||||
tracker.setBalance(uint64(time.Minute), 0)
|
tracker.setBalance(uint64(time.Minute), 0)
|
||||||
tracker.addCallback(balanceCallbackZero, 0, func() {callCh <- struct{}{}})
|
tracker.addCallback(balanceCallbackZero, 0, func() { callCh <- struct{}{} })
|
||||||
|
|
||||||
clock.Run(time.Minute)
|
clock.Run(time.Minute)
|
||||||
select {
|
select {
|
||||||
|
|
@ -248,13 +248,13 @@ func TestCallback(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tracker.setBalance(uint64(time.Minute), 0)
|
tracker.setBalance(uint64(time.Minute), 0)
|
||||||
tracker.addCallback(balanceCallbackZero, 0, func() {callCh <- struct{}{}})
|
tracker.addCallback(balanceCallbackZero, 0, func() { callCh <- struct{}{} })
|
||||||
tracker.removeCallback(balanceCallbackZero)
|
tracker.removeCallback(balanceCallbackZero)
|
||||||
|
|
||||||
clock.Run(time.Minute)
|
clock.Run(time.Minute)
|
||||||
select {
|
select {
|
||||||
case <-callCh:
|
case <-callCh:
|
||||||
t.Fatalf("Callback shouldn't be called")
|
t.Fatalf("Callback shouldn't be called")
|
||||||
case <-time.NewTimer(time.Millisecond*100).C:
|
case <-time.NewTimer(time.Millisecond * 100).C:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ const (
|
||||||
// accepting and instantly kicking out clients. In theory, we try to ensure that
|
// accepting and instantly kicking out clients. In theory, we try to ensure that
|
||||||
// each client can have several minutes of connection time.
|
// each client can have several minutes of connection time.
|
||||||
//
|
//
|
||||||
// Balances of disconnected clients are stored in nodeDB including postive balance
|
// Balances of disconnected clients are stored in nodeDB including positive balance
|
||||||
// and negative banalce. Negative balance is transformed into a logarithmic form
|
// and negative banalce. Negative balance is transformed into a logarithmic form
|
||||||
// with a constantly shifting linear offset in order to implement an exponential
|
// with a constantly shifting linear offset in order to implement an exponential
|
||||||
// decrease. Besides nodeDB will have a background thread to check the negative
|
// decrease. Besides nodeDB will have a background thread to check the negative
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue