@ -180,7 +180,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV1(update engine.ForkchoiceStateV1, pa
return engine . STATUS_INVALID , engine . InvalidParams . With ( errors . New ( "forkChoiceUpdateV1 called post-shanghai" ) )
}
}
return api . forkchoiceUpdated ( update , payloadAttributes , false )
return api . forkchoiceUpdated ( update , payloadAttributes , engine . PayloadV1 , false )
}
// ForkchoiceUpdatedV2 is equivalent to V1 with the addition of withdrawals in the payload attributes.
@ -196,7 +196,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV2(update engine.ForkchoiceStateV1, pa
return engine . STATUS_INVALID , engine . UnsupportedFork . With ( errors . New ( "forkchoiceUpdatedV2 must only be called for shanghai payloads" ) )
}
}
return api . forkchoiceUpdated ( update , params , false )
return api . forkchoiceUpdated ( update , params , engine . PayloadV2 , false )
}
// ForkchoiceUpdatedV3 is equivalent to V2 with the addition of parent beacon block root in the payload attributes.
@ -220,10 +220,10 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV3(update engine.ForkchoiceStateV1, pa
// hash, even if params are wrong. To do this we need to split up
// forkchoiceUpdate into a function that only updates the head and then a
// function that kicks off block construction.
return api . forkchoiceUpdated ( update , params , false )
return api . forkchoiceUpdated ( update , params , engine . PayloadV3 , false )
}
func ( api * ConsensusAPI ) forkchoiceUpdated ( update engine . ForkchoiceStateV1 , payloadAttributes * engine . PayloadAttributes , simulatorMode bool ) ( engine . ForkChoiceResponse , error ) {
func ( api * ConsensusAPI ) forkchoiceUpdated ( update engine . ForkchoiceStateV1 , payloadAttributes * engine . PayloadAttributes , payloadVersion engine . PayloadVersion , simulatorMode bool ) ( engine . ForkChoiceResponse , error ) {
api . forkchoiceLock . Lock ( )
defer api . forkchoiceLock . Unlock ( )
@ -367,6 +367,7 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl
Random : payloadAttributes . Random ,
Withdrawals : payloadAttributes . Withdrawals ,
BeaconRoot : payloadAttributes . BeaconRoot ,
Version : payloadVersion ,
}
id := args . Id ( )
// If we already are busy generating this work, then we do not need
@ -430,6 +431,9 @@ func (api *ConsensusAPI) ExchangeTransitionConfigurationV1(config engine.Transit
// GetPayloadV1 returns a cached payload by id.
func ( api * ConsensusAPI ) GetPayloadV1 ( payloadID engine . PayloadID ) ( * engine . ExecutableData , error ) {
if ! payloadID . Is ( engine . PayloadV1 ) {
return nil , engine . UnsupportedFork
}
data , err := api . getPayload ( payloadID , false )
if err != nil {
return nil , err
@ -439,11 +443,17 @@ func (api *ConsensusAPI) GetPayloadV1(payloadID engine.PayloadID) (*engine.Execu
// GetPayloadV2 returns a cached payload by id.
func ( api * ConsensusAPI ) GetPayloadV2 ( payloadID engine . PayloadID ) ( * engine . ExecutionPayloadEnvelope , error ) {
if ! payloadID . Is ( engine . PayloadV1 , engine . PayloadV2 ) {
return nil , engine . UnsupportedFork
}
return api . getPayload ( payloadID , false )
}
// GetPayloadV3 returns a cached payload by id.
func ( api * ConsensusAPI ) GetPayloadV3 ( payloadID engine . PayloadID ) ( * engine . ExecutionPayloadEnvelope , error ) {
if ! payloadID . Is ( engine . PayloadV3 ) {
return nil , engine . UnsupportedFork
}
return api . getPayload ( payloadID , false )
}