@@ -180,7 +180,7 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV1(update engine.ForkchoiceStateV1, pa
180
180
return engine .STATUS_INVALID , engine .InvalidParams .With (errors .New ("forkChoiceUpdateV1 called post-shanghai" ))
181
181
}
182
182
}
183
- return api .forkchoiceUpdated (update , payloadAttributes , false )
183
+ return api .forkchoiceUpdated (update , payloadAttributes , engine . PayloadV1 , false )
184
184
}
185
185
186
186
// 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
196
196
return engine .STATUS_INVALID , engine .UnsupportedFork .With (errors .New ("forkchoiceUpdatedV2 must only be called for shanghai payloads" ))
197
197
}
198
198
}
199
- return api .forkchoiceUpdated (update , params , false )
199
+ return api .forkchoiceUpdated (update , params , engine . PayloadV2 , false )
200
200
}
201
201
202
202
// 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
220
220
// hash, even if params are wrong. To do this we need to split up
221
221
// forkchoiceUpdate into a function that only updates the head and then a
222
222
// function that kicks off block construction.
223
- return api .forkchoiceUpdated (update , params , false )
223
+ return api .forkchoiceUpdated (update , params , engine . PayloadV3 , false )
224
224
}
225
225
226
- func (api * ConsensusAPI ) forkchoiceUpdated (update engine.ForkchoiceStateV1 , payloadAttributes * engine.PayloadAttributes , simulatorMode bool ) (engine.ForkChoiceResponse , error ) {
226
+ func (api * ConsensusAPI ) forkchoiceUpdated (update engine.ForkchoiceStateV1 , payloadAttributes * engine.PayloadAttributes , payloadVersion engine. PayloadVersion , simulatorMode bool ) (engine.ForkChoiceResponse , error ) {
227
227
api .forkchoiceLock .Lock ()
228
228
defer api .forkchoiceLock .Unlock ()
229
229
@@ -367,6 +367,7 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl
367
367
Random : payloadAttributes .Random ,
368
368
Withdrawals : payloadAttributes .Withdrawals ,
369
369
BeaconRoot : payloadAttributes .BeaconRoot ,
370
+ Version : payloadVersion ,
370
371
}
371
372
id := args .Id ()
372
373
// If we already are busy generating this work, then we do not need
@@ -430,6 +431,9 @@ func (api *ConsensusAPI) ExchangeTransitionConfigurationV1(config engine.Transit
430
431
431
432
// GetPayloadV1 returns a cached payload by id.
432
433
func (api * ConsensusAPI ) GetPayloadV1 (payloadID engine.PayloadID ) (* engine.ExecutableData , error ) {
434
+ if ! payloadID .Is (engine .PayloadV1 ) {
435
+ return nil , engine .UnsupportedFork
436
+ }
433
437
data , err := api .getPayload (payloadID , false )
434
438
if err != nil {
435
439
return nil , err
@@ -439,11 +443,17 @@ func (api *ConsensusAPI) GetPayloadV1(payloadID engine.PayloadID) (*engine.Execu
439
443
440
444
// GetPayloadV2 returns a cached payload by id.
441
445
func (api * ConsensusAPI ) GetPayloadV2 (payloadID engine.PayloadID ) (* engine.ExecutionPayloadEnvelope , error ) {
446
+ if ! payloadID .Is (engine .PayloadV1 , engine .PayloadV2 ) {
447
+ return nil , engine .UnsupportedFork
448
+ }
442
449
return api .getPayload (payloadID , false )
443
450
}
444
451
445
452
// GetPayloadV3 returns a cached payload by id.
446
453
func (api * ConsensusAPI ) GetPayloadV3 (payloadID engine.PayloadID ) (* engine.ExecutionPayloadEnvelope , error ) {
454
+ if ! payloadID .Is (engine .PayloadV3 ) {
455
+ return nil , engine .UnsupportedFork
456
+ }
447
457
return api .getPayload (payloadID , false )
448
458
}
449
459
0 commit comments