diff --git a/les/balance_test.go b/les/balance_test.go index b3c1cbcd05..b571c2cc5c 100644 --- a/les/balance_test.go +++ b/les/balance_test.go @@ -181,13 +181,13 @@ func TestEstimatedPriority(t *testing.T) { // 3 seconds time cost, 3 second estimated time cost, 10^9*2 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 - {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. - {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 { clock.Run(i.runTime) @@ -209,13 +209,13 @@ func TestCallbackChecking(t *testing.T) { tracker.setFactors(false, 1, 1) tracker.setFactors(true, 1, 1) - var inputs = []struct{ + var inputs = []struct { priority int64 expDiff time.Duration - } { - {^int64(500), time.Millisecond*500}, + }{ + {^int64(500), time.Millisecond * 500}, {0, time.Second}, - {int64(time.Second), 2*time.Second}, + {int64(time.Second), 2 * time.Second}, } tracker.setBalance(uint64(time.Second), 0) for _, i := range inputs { @@ -238,7 +238,7 @@ func TestCallback(t *testing.T) { callCh := make(chan struct{}, 1) tracker.setBalance(uint64(time.Minute), 0) - tracker.addCallback(balanceCallbackZero, 0, func() {callCh <- struct{}{}}) + tracker.addCallback(balanceCallbackZero, 0, func() { callCh <- struct{}{} }) clock.Run(time.Minute) select { @@ -248,13 +248,13 @@ func TestCallback(t *testing.T) { } tracker.setBalance(uint64(time.Minute), 0) - tracker.addCallback(balanceCallbackZero, 0, func() {callCh <- struct{}{}}) + tracker.addCallback(balanceCallbackZero, 0, func() { callCh <- struct{}{} }) tracker.removeCallback(balanceCallbackZero) clock.Run(time.Minute) select { case <-callCh: t.Fatalf("Callback shouldn't be called") - case <-time.NewTimer(time.Millisecond*100).C: + case <-time.NewTimer(time.Millisecond * 100).C: } } diff --git a/les/clientpool.go b/les/clientpool.go index bead3dd2a4..7013a8f8ed 100644 --- a/les/clientpool.go +++ b/les/clientpool.go @@ -66,7 +66,7 @@ const ( // accepting and instantly kicking out clients. In theory, we try to ensure that // 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 // with a constantly shifting linear offset in order to implement an exponential // decrease. Besides nodeDB will have a background thread to check the negative