From ae1b193d6f5bd03e086a19b9515c0cb53f4269f8 Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Tue, 13 Jun 2023 10:55:59 +0700 Subject: [PATCH] use 1 constant in tests to configure initialCycle variable (#7720) --- cmd/rpcdaemon/commands/eth_subscribe_test.go | 2 +- cmd/rpcdaemon/commands/send_transaction_test.go | 2 +- turbo/stages/mock_sentry.go | 2 +- turbo/stages/sentry_mock_test.go | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/rpcdaemon/commands/eth_subscribe_test.go b/cmd/rpcdaemon/commands/eth_subscribe_test.go index 8697c676a..dd1d1993c 100644 --- a/cmd/rpcdaemon/commands/eth_subscribe_test.go +++ b/cmd/rpcdaemon/commands/eth_subscribe_test.go @@ -50,7 +50,7 @@ func TestEthSubscribe(t *testing.T) { newHeads, id := ff.SubscribeNewHeads(16) defer ff.UnsubscribeHeads(id) - initialCycle := true + initialCycle := stages.MockInsertAsInitialCycle highestSeenHeader := chain.TopBlock.NumberU64() hook := stages.NewHook(m.Ctx, m.Notifications, m.Sync, br, m.ChainConfig, m.Log, m.UpdateHead) diff --git a/cmd/rpcdaemon/commands/send_transaction_test.go b/cmd/rpcdaemon/commands/send_transaction_test.go index 332f13700..e501117cc 100644 --- a/cmd/rpcdaemon/commands/send_transaction_test.go +++ b/cmd/rpcdaemon/commands/send_transaction_test.go @@ -60,7 +60,7 @@ func TestSendRawTransaction(t *testing.T) { } m.ReceiveWg.Wait() // Wait for all messages to be processed before we proceeed - initialCycle := true + initialCycle := stages.MockInsertAsInitialCycle if _, err := stages.StageLoopStep(m.Ctx, m.DB, m.Sync, initialCycle, logger, nil, nil); err != nil { t.Fatal(err) } diff --git a/turbo/stages/mock_sentry.go b/turbo/stages/mock_sentry.go index b8463dfb7..902379b65 100644 --- a/turbo/stages/mock_sentry.go +++ b/turbo/stages/mock_sentry.go @@ -608,7 +608,7 @@ func (ms *MockSentry) insertPoSBlocks(chain *core.ChainPack) error { ms.SendPayloadRequest(chain.Blocks[i]) } - initialCycle := false + initialCycle := MockInsertAsInitialCycle blockReader, _ := ms.NewBlocksIO() hook := NewHook(ms.Ctx, ms.Notifications, ms.Sync, blockReader, ms.ChainConfig, ms.Log, ms.UpdateHead) headBlockHash, err := StageLoopStep(ms.Ctx, ms.DB, ms.Sync, initialCycle, ms.Log, blockReader.Snapshots().(*snapshotsync.RoSnapshots), hook) diff --git a/turbo/stages/sentry_mock_test.go b/turbo/stages/sentry_mock_test.go index aa1cedf48..e8ea90c50 100644 --- a/turbo/stages/sentry_mock_test.go +++ b/turbo/stages/sentry_mock_test.go @@ -163,7 +163,7 @@ func TestReorg(t *testing.T) { } m.ReceiveWg.Wait() // Wait for all messages to be processed before we proceeed - initialCycle := true + initialCycle := stages.MockInsertAsInitialCycle if _, err := stages.StageLoopStep(m.Ctx, m.DB, m.Sync, initialCycle, m.Log, m.BlockSnapshots, nil); err != nil { t.Fatal(err) } @@ -392,7 +392,7 @@ func TestAnchorReplace(t *testing.T) { m.ReceiveWg.Wait() // Wait for all messages to be processed before we proceeed - initialCycle := true + initialCycle := stages.MockInsertAsInitialCycle if _, err := stages.StageLoopStep(m.Ctx, m.DB, m.Sync, initialCycle, m.Log, m.BlockSnapshots, nil); err != nil { t.Fatal(err) } @@ -497,7 +497,7 @@ func TestAnchorReplace2(t *testing.T) { m.ReceiveWg.Wait() // Wait for all messages to be processed before we proceeed br, _ := m.NewBlocksIO() - initialCycle := true + initialCycle := stages.MockInsertAsInitialCycle hook := stages.NewHook(m.Ctx, m.Notifications, m.Sync, br, m.ChainConfig, m.Log, m.UpdateHead) if _, err := stages.StageLoopStep(m.Ctx, m.DB, m.Sync, initialCycle, m.Log, m.BlockSnapshots, hook); err != nil { t.Fatal(err)