From c412168e1c0ff5d95797b4a9edc39c1ee7be3029 Mon Sep 17 00:00:00 2001 From: Abdul Rabbani Date: Thu, 16 Jun 2022 16:13:21 -0400 Subject: [PATCH] Make lint changes --- cmd/geth/config.go | 6 +++--- statediff/known_gaps_test.go | 2 -- statediff/service_test.go | 2 +- statediff/test_helpers/mocks/blockchain.go | 1 - statediff/test_helpers/mocks/service_test.go | 4 ++-- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/cmd/geth/config.go b/cmd/geth/config.go index b8e80c397..fb531027e 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -241,13 +241,13 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) { pgConfig.MaxIdle = ctx.GlobalInt(utils.StateDiffDBMaxIdleConns.Name) } if ctx.GlobalIsSet(utils.StateDiffDBMaxConnLifetime.Name) { - pgConfig.MaxConnLifetime = ctx.GlobalDuration(utils.StateDiffDBMaxConnLifetime.Name) * time.Second + pgConfig.MaxConnLifetime = time.Duration(ctx.GlobalDuration(utils.StateDiffDBMaxConnLifetime.Name).Seconds()) } if ctx.GlobalIsSet(utils.StateDiffDBMaxConnIdleTime.Name) { - pgConfig.MaxConnIdleTime = ctx.GlobalDuration(utils.StateDiffDBMaxConnIdleTime.Name) * time.Second + pgConfig.MaxConnIdleTime = time.Duration(ctx.GlobalDuration(utils.StateDiffDBMaxConnIdleTime.Name).Seconds()) } if ctx.GlobalIsSet(utils.StateDiffDBConnTimeout.Name) { - pgConfig.ConnTimeout = ctx.GlobalDuration(utils.StateDiffDBConnTimeout.Name) * time.Second + pgConfig.ConnTimeout = time.Duration(ctx.GlobalDuration(utils.StateDiffDBConnTimeout.Name).Seconds()) } indexerConfig = pgConfig case shared.DUMP: diff --git a/statediff/known_gaps_test.go b/statediff/known_gaps_test.go index bd1c72a2a..11463b7ad 100644 --- a/statediff/known_gaps_test.go +++ b/statediff/known_gaps_test.go @@ -18,8 +18,6 @@ var ( ) type gapValues struct { - lastProcessedBlock int64 - currentBlock int64 knownErrorBlocksStart int64 knownErrorBlocksEnd int64 expectedDif int64 diff --git a/statediff/service_test.go b/statediff/service_test.go index f9a08bbf1..c3060601d 100644 --- a/statediff/service_test.go +++ b/statediff/service_test.go @@ -112,8 +112,8 @@ func testErrorInChainEventLoop(t *testing.T) { payloads := make([]statediff.Payload, 0, 2) wg := new(sync.WaitGroup) + wg.Add(1) go func() { - wg.Add(1) for i := 0; i < 2; i++ { select { case payload := <-payloadChan: diff --git a/statediff/test_helpers/mocks/blockchain.go b/statediff/test_helpers/mocks/blockchain.go index f2a77af64..0c6ff9424 100644 --- a/statediff/test_helpers/mocks/blockchain.go +++ b/statediff/test_helpers/mocks/blockchain.go @@ -34,7 +34,6 @@ type BlockChain struct { HashesLookedUp []common.Hash blocksToReturnByHash map[common.Hash]*types.Block blocksToReturnByNumber map[uint64]*types.Block - callCount int ChainEvents []core.ChainEvent Receipts map[common.Hash]types.Receipts TDByHash map[common.Hash]*big.Int diff --git a/statediff/test_helpers/mocks/service_test.go b/statediff/test_helpers/mocks/service_test.go index 4911163be..fa073393a 100644 --- a/statediff/test_helpers/mocks/service_test.go +++ b/statediff/test_helpers/mocks/service_test.go @@ -154,8 +154,8 @@ func testSubscriptionAPI(t *testing.T) { payloadChan := make(chan statediff.Payload) quitChan := make(chan bool) wg := new(sync.WaitGroup) + wg.Add(1) go func() { - wg.Add(1) defer wg.Done() sort.Slice(expectedStateDiffBytes, func(i, j int) bool { return expectedStateDiffBytes[i] < expectedStateDiffBytes[j] }) select { @@ -177,7 +177,7 @@ func testSubscriptionAPI(t *testing.T) { t.Errorf("channel quit before delivering payload") } }() - time.Sleep(1) + time.Sleep(1 * time.Second) mockService.Subscribe(id, payloadChan, quitChan, parameters) blockChan <- block1 parentBlockChain <- block0