Skip to content

Commit

Permalink
eth/catalyst: remove error return in delayPayloadImport (ethereum#29043)
Browse files Browse the repository at this point in the history
Co-authored-by: tmelhao <tmelhao@gmail.com>
  • Loading branch information
tmelhao and tmelhao authored Mar 13, 2024
1 parent 57308be commit 3c26ffe
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions eth/catalyst/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ func (api *ConsensusAPI) newPayload(params engine.ExecutableData, versionedHashe
// update after legit payload executions.
parent := api.eth.BlockChain().GetBlock(block.ParentHash(), block.NumberU64()-1)
if parent == nil {
return api.delayPayloadImport(block)
return api.delayPayloadImport(block), nil
}
// We have an existing parent, do some sanity checks to avoid the beacon client
// triggering too early
Expand All @@ -593,7 +593,7 @@ func (api *ConsensusAPI) newPayload(params engine.ExecutableData, versionedHashe
// into the database directly will conflict with the assumptions of snap sync
// that it has an empty db that it can fill itself.
if api.eth.SyncMode() != downloader.FullSync {
return api.delayPayloadImport(block)
return api.delayPayloadImport(block), nil
}
if !api.eth.BlockChain().HasBlockAndState(block.ParentHash(), block.NumberU64()-1) {
api.remoteBlocks.put(block.Hash(), block.Header())
Expand All @@ -619,11 +619,11 @@ func (api *ConsensusAPI) newPayload(params engine.ExecutableData, versionedHashe
// either via a forkchoice update or a sync extension. This method is meant to
// be called by the newpayload command when the block seems to be ok, but some
// prerequisite prevents it from being processed (e.g. no parent, or snap sync).
func (api *ConsensusAPI) delayPayloadImport(block *types.Block) (engine.PayloadStatusV1, error) {
func (api *ConsensusAPI) delayPayloadImport(block *types.Block) engine.PayloadStatusV1 {
// Sanity check that this block's parent is not on a previously invalidated
// chain. If it is, mark the block as invalid too.
if res := api.checkInvalidAncestor(block.ParentHash(), block.Hash()); res != nil {
return *res, nil
return *res
}
// Stash the block away for a potential forced forkchoice update to it
// at a later time.
Expand All @@ -635,7 +635,7 @@ func (api *ConsensusAPI) delayPayloadImport(block *types.Block) (engine.PayloadS
err := api.eth.Downloader().BeaconExtend(api.eth.SyncMode(), block.Header())
if err == nil {
log.Debug("Payload accepted for sync extension", "number", block.NumberU64(), "hash", block.Hash())
return engine.PayloadStatusV1{Status: engine.SYNCING}, nil
return engine.PayloadStatusV1{Status: engine.SYNCING}
}
// Either no beacon sync was started yet, or it rejected the delivered
// payload as non-integratable on top of the existing sync. We'll just
Expand All @@ -652,7 +652,7 @@ func (api *ConsensusAPI) delayPayloadImport(block *types.Block) (engine.PayloadS
// and cannot afford concurrent out-if-band modifications via imports.
log.Warn("Ignoring payload while snap syncing", "number", block.NumberU64(), "hash", block.Hash(), "reason", err)
}
return engine.PayloadStatusV1{Status: engine.SYNCING}, nil
return engine.PayloadStatusV1{Status: engine.SYNCING}
}

// setInvalidAncestor is a callback for the downloader to notify us if a bad block
Expand Down

0 comments on commit 3c26ffe

Please sign in to comment.