Skip to content

Commit

Permalink
eth/catalyst: added tracing info to engine api
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusVanDerWijden committed Jan 14, 2022
1 parent 1d4e02f commit 3c1e5fb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eth/catalyst/api.go
Expand Up @@ -183,6 +183,7 @@ func (api *ConsensusAPI) makeEnv(parent *types.Block, header *types.Header) (*bl
}

func (api *ConsensusAPI) GetPayloadV1(payloadID PayloadID) (*ExecutableDataV1, error) {
log.Trace("GetPayload", "payloadID", payloadID)
data, ok := api.preparedBlocks.Get(payloadID)
if !ok {
return nil, &UnknownPayload
Expand All @@ -191,6 +192,7 @@ func (api *ConsensusAPI) GetPayloadV1(payloadID PayloadID) (*ExecutableDataV1, e
}

func (api *ConsensusAPI) ForkchoiceUpdatedV1(heads ForkchoiceStateV1, PayloadAttributes *PayloadAttributesV1) (ForkChoiceResponse, error) {
log.Trace("ForkChoiceUpdatedV1", "head", heads.HeadBlockHash, "finalBH", heads.FinalizedBlockHash, "safeBH", heads.SafeBlockHash)
if heads.HeadBlockHash == (common.Hash{}) {
return ForkChoiceResponse{Status: SUCCESS.Status, PayloadID: nil}, nil
}
Expand Down Expand Up @@ -246,6 +248,7 @@ func (api *ConsensusAPI) invalid() ExecutePayloadResponse {

// ExecutePayload creates an Eth1 block, inserts it in the chain, and returns the status of the chain.
func (api *ConsensusAPI) ExecutePayloadV1(params ExecutableDataV1) (ExecutePayloadResponse, error) {
log.Trace("ExecutePayloadV1", "hash", params.BlockHash, "number", params.Number)
block, err := ExecutableDataToBlock(params)
if err != nil {
return api.invalid(), err
Expand Down Expand Up @@ -276,6 +279,7 @@ func (api *ConsensusAPI) ExecutePayloadV1(params ExecutableDataV1) (ExecutePaylo
if td.Cmp(ttd) < 0 {
return api.invalid(), fmt.Errorf("can not execute payload on top of block with low td got: %v threshold %v", td, ttd)
}
log.Trace("InsertingBlockWithoutSetHead", "hash", block.Hash(), "number", block.Number)
if err := api.eth.BlockChain().InsertBlockWithoutSetHead(block); err != nil {
return api.invalid(), err
}
Expand Down

0 comments on commit 3c1e5fb

Please sign in to comment.