From d853d175710052aa68237c0bb33fd5db21cd1686 Mon Sep 17 00:00:00 2001 From: devopsbo3 <69951731+devopsbo3@users.noreply.github.com> Date: Fri, 10 Nov 2023 12:27:53 -0600 Subject: [PATCH] Revert "eth/catalyst: disable heartbeat for simulated beacon node (#27979)" This reverts commit b71919e5e23cfa97c6bdce9658fec7b34077286c. --- eth/catalyst/api.go | 9 ++------- eth/catalyst/simulated_beacon.go | 2 +- eth/catalyst/tester.go | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index f6c7ab09c7..30b1d4331f 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -135,13 +135,6 @@ type ConsensusAPI struct { // NewConsensusAPI creates a new consensus api for the given backend. // The underlying blockchain needs to have a valid terminal total difficulty set. func NewConsensusAPI(eth *eth.Ethereum) *ConsensusAPI { - api := newConsensusAPIWithoutHeartbeat(eth) - go api.heartbeat() - return api -} - -// newConsensusAPIWithoutHeartbeat creates a new consensus api for the SimulatedBeacon Node. -func newConsensusAPIWithoutHeartbeat(eth *eth.Ethereum) *ConsensusAPI { if eth.BlockChain().Config().TerminalTotalDifficulty == nil { log.Warn("Engine API started but chain not configured for merge yet") } @@ -153,6 +146,8 @@ func newConsensusAPIWithoutHeartbeat(eth *eth.Ethereum) *ConsensusAPI { invalidTipsets: make(map[common.Hash]*types.Header), } eth.Downloader().SetBadBlockCallback(api.setInvalidAncestor) + go api.heartbeat() + return api } diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index dc623d48ea..e319264f4c 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -92,7 +92,7 @@ func NewSimulatedBeacon(period uint64, eth *eth.Ethereum) (*SimulatedBeacon, err SafeBlockHash: block.Hash(), FinalizedBlockHash: block.Hash(), } - engineAPI := newConsensusAPIWithoutHeartbeat(eth) + engineAPI := NewConsensusAPI(eth) // if genesis block, send forkchoiceUpdated to trigger transition to PoS if block.Number.Sign() == 0 { diff --git a/eth/catalyst/tester.go b/eth/catalyst/tester.go index f34a3f79ae..c4eafd30d9 100644 --- a/eth/catalyst/tester.go +++ b/eth/catalyst/tester.go @@ -42,7 +42,7 @@ type FullSyncTester struct { // stack for launching and stopping the service controlled by node. func RegisterFullSyncTester(stack *node.Node, backend *eth.Ethereum, block *types.Block) (*FullSyncTester, error) { cl := &FullSyncTester{ - api: newConsensusAPIWithoutHeartbeat(backend), + api: NewConsensusAPI(backend), block: block, closed: make(chan struct{}), }