Revert "eth/catalyst: disable heartbeat for simulated beacon node (#27979)"

This reverts commit b71919e5e2.
This commit is contained in:
devopsbo3 2023-11-10 12:27:53 -06:00 committed by GitHub
parent ff01eb5aa6
commit d853d17571
3 changed files with 4 additions and 9 deletions

View file

@ -135,13 +135,6 @@ type ConsensusAPI struct {
// NewConsensusAPI creates a new consensus api for the given backend. // NewConsensusAPI creates a new consensus api for the given backend.
// The underlying blockchain needs to have a valid terminal total difficulty set. // The underlying blockchain needs to have a valid terminal total difficulty set.
func NewConsensusAPI(eth *eth.Ethereum) *ConsensusAPI { 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 { if eth.BlockChain().Config().TerminalTotalDifficulty == nil {
log.Warn("Engine API started but chain not configured for merge yet") 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), invalidTipsets: make(map[common.Hash]*types.Header),
} }
eth.Downloader().SetBadBlockCallback(api.setInvalidAncestor) eth.Downloader().SetBadBlockCallback(api.setInvalidAncestor)
go api.heartbeat()
return api return api
} }

View file

@ -92,7 +92,7 @@ func NewSimulatedBeacon(period uint64, eth *eth.Ethereum) (*SimulatedBeacon, err
SafeBlockHash: block.Hash(), SafeBlockHash: block.Hash(),
FinalizedBlockHash: block.Hash(), FinalizedBlockHash: block.Hash(),
} }
engineAPI := newConsensusAPIWithoutHeartbeat(eth) engineAPI := NewConsensusAPI(eth)
// if genesis block, send forkchoiceUpdated to trigger transition to PoS // if genesis block, send forkchoiceUpdated to trigger transition to PoS
if block.Number.Sign() == 0 { if block.Number.Sign() == 0 {

View file

@ -42,7 +42,7 @@ type FullSyncTester struct {
// stack for launching and stopping the service controlled by node. // stack for launching and stopping the service controlled by node.
func RegisterFullSyncTester(stack *node.Node, backend *eth.Ethereum, block *types.Block) (*FullSyncTester, error) { func RegisterFullSyncTester(stack *node.Node, backend *eth.Ethereum, block *types.Block) (*FullSyncTester, error) {
cl := &FullSyncTester{ cl := &FullSyncTester{
api: newConsensusAPIWithoutHeartbeat(backend), api: NewConsensusAPI(backend),
block: block, block: block,
closed: make(chan struct{}), closed: make(chan struct{}),
} }