lint: various fixes

## Description

various linitng fixes
This commit is contained in:
Marko
2020-05-18 12:20:06 +02:00
committed by GitHub
parent d1d33057dc
commit 9149ee7d8b
14 changed files with 36 additions and 44 deletions

View File

@@ -1,7 +1,6 @@
package p2p
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
@@ -24,8 +23,8 @@ func TestNodeInfoValidate(t *testing.T) {
dupChannels = append(dupChannels, testCh)
nonASCII := "¢§µ"
emptyTab := fmt.Sprintf("\t")
emptySpace := fmt.Sprintf(" ")
emptyTab := "\t"
emptySpace := " "
testCases := []struct {
testName string

View File

@@ -11,7 +11,6 @@ import (
"github.com/tendermint/tendermint/libs/cmap"
tmmath "github.com/tendermint/tendermint/libs/math"
"github.com/tendermint/tendermint/libs/rand"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/libs/service"
"github.com/tendermint/tendermint/p2p"
@@ -409,7 +408,7 @@ func (r *Reactor) SetEnsurePeersPeriod(d time.Duration) {
// Ensures that sufficient peers are connected. (continuous)
func (r *Reactor) ensurePeersRoutine() {
var (
seed = rand.NewRand()
seed = tmrand.NewRand()
jitter = seed.Int63n(r.ensurePeersPeriod.Nanoseconds())
)
@@ -545,8 +544,8 @@ func (r *Reactor) dialPeer(addr *p2p.NetAddress) error {
// exponential backoff if it's not our first attempt to dial given address
if attempts > 0 {
jitterSeconds := time.Duration(tmrand.Float64() * float64(time.Second)) // 1s == (1e9 ns)
backoffDuration := jitterSeconds + ((1 << uint(attempts)) * time.Second)
jitter := time.Duration(tmrand.Float64() * float64(time.Second)) // 1s == (1e9 ns)
backoffDuration := jitter + ((1 << uint(attempts)) * time.Second)
backoffDuration = r.maxBackoffDurationForPeer(addr, backoffDuration)
sinceLastDialed := time.Since(lastDialed)
if sinceLastDialed < backoffDuration {