eth/catalyst: disable heartbeat for simulated beacon node

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2023-08-23 12:13:56 +08:00
parent 4c7053baf1
commit af54fd5495
2 changed files with 18 additions and 1 deletions

View file

@ -151,6 +151,23 @@ func NewConsensusAPI(eth *eth.Ethereum) *ConsensusAPI {
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")
}
api := &ConsensusAPI{
eth: eth,
remoteBlocks: newHeaderQueue(),
localBlocks: newPayloadQueue(),
invalidBlocksHits: make(map[common.Hash]int),
invalidTipsets: make(map[common.Hash]*types.Header),
}
eth.Downloader().SetBadBlockCallback(api.setInvalidAncestor)
return api
}
// ForkchoiceUpdatedV1 has several responsibilities:
//
// We try to set our blockchain to the headBlock.

View file

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