mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth/catalyst: update
This commit is contained in:
parent
af54fd5495
commit
2552327184
1 changed files with 1 additions and 13 deletions
|
|
@ -135,19 +135,8 @@ 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 {
|
||||||
if eth.BlockChain().Config().TerminalTotalDifficulty == nil {
|
api := newConsensusAPIWithoutHeartbeat(eth)
|
||||||
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)
|
|
||||||
go api.heartbeat()
|
go api.heartbeat()
|
||||||
|
|
||||||
return api
|
return api
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -164,7 +153,6 @@ 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)
|
||||||
|
|
||||||
return api
|
return api
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue