Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/rawdb/accessors_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func ReadFinalizedBlockHash(db ethdb.KeyValueReader) common.Hash {
// WriteFinalizedBlockHash stores the hash of the finalized block.
func WriteFinalizedBlockHash(db ethdb.KeyValueWriter, hash common.Hash) {
if err := db.Put(headFinalizedBlockKey, hash.Bytes()); err != nil {
log.Crit("Failed to store last fast block's hash", "err", err)
log.Crit("Failed to store last finalized block's hash", "err", err)
}
}

Expand Down
16 changes: 8 additions & 8 deletions eth/catalyst/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ type ConsensusAPI struct {
eth *eth.Ethereum
remoteBlocks *headerQueue // Cache of remote payloads received
localBlocks *payloadQueue // Cache of local payloads generated
// Lock for the FCU method
mu *sync.Mutex
// Lock for the forkChoiceUpdated method
forkChoiceLock *sync.Mutex
}

// NewConsensusAPI creates a new consensus api for the given backend.
Expand All @@ -72,10 +72,10 @@ func NewConsensusAPI(eth *eth.Ethereum) *ConsensusAPI {
panic("Catalyst started without valid total difficulty")
}
return &ConsensusAPI{
eth: eth,
remoteBlocks: newHeaderQueue(),
localBlocks: newPayloadQueue(),
mu: new(sync.Mutex),
eth: eth,
remoteBlocks: newHeaderQueue(),
localBlocks: newPayloadQueue(),
forkChoiceLock: new(sync.Mutex),
}
}

Expand All @@ -90,8 +90,8 @@ func NewConsensusAPI(eth *eth.Ethereum) *ConsensusAPI {
// If there are payloadAttributes:
// we try to assemble a block with the payloadAttributes and return its payloadID
func (api *ConsensusAPI) ForkchoiceUpdatedV1(update beacon.ForkchoiceStateV1, payloadAttributes *beacon.PayloadAttributesV1) (beacon.ForkChoiceResponse, error) {
api.mu.Lock()
defer api.mu.Unlock()
api.forkChoiceLock.Lock()
defer api.forkChoiceLock.Unlock()

log.Trace("Engine API request received", "method", "ForkchoiceUpdated", "head", update.HeadBlockHash, "finalized", update.FinalizedBlockHash, "safe", update.SafeBlockHash)
if update.HeadBlockHash == (common.Hash{}) {
Expand Down