@@ -413,10 +413,6 @@ func (api *ConsensusAPI) GetPayloadV1(payloadID engine.PayloadID) (*engine.Execu
413
413
if err != nil {
414
414
return nil , err
415
415
}
416
- // Check if the payload timestamp is greater or equal to Shanghai activation timestamp
417
- if data .ExecutionPayload != nil && api .config ().LatestFork (data .ExecutionPayload .Timestamp ) >= forks .Shanghai {
418
- return nil , engine .UnsupportedFork .With (errors .New ("engine_getPayloadV1 is not available after Shanghai fork" ))
419
- }
420
416
return data .ExecutionPayload , nil
421
417
}
422
418
@@ -436,9 +432,9 @@ func (api *ConsensusAPI) GetPayloadV2(payloadID engine.PayloadID) (*engine.Execu
436
432
if err != nil {
437
433
return nil , err
438
434
}
439
- // Check if the payload timestamp is greater or equal to Cancun activation timestamp
440
- if data .ExecutionPayload != nil && api .config (). LatestFork ( data .ExecutionPayload .Timestamp ) >= forks .Cancun {
441
- return nil , engine .UnsupportedFork . With ( errors . New ( "engine_getPayloadV2 is not available after Cancun fork" ))
435
+ // Check if the payload timestamp falls within the Shanghai fork timeframe
436
+ if data .ExecutionPayload != nil && ! api .checkFork ( data .ExecutionPayload .Timestamp , forks .Shanghai ) {
437
+ return nil , engine .UnsupportedFork
442
438
}
443
439
return data , nil
444
440
}
@@ -453,9 +449,9 @@ func (api *ConsensusAPI) GetPayloadV3(payloadID engine.PayloadID) (*engine.Execu
453
449
if err != nil {
454
450
return nil , err
455
451
}
456
- // Check if the payload timestamp is greater or equal to Prague activation timestamp
457
- if data .ExecutionPayload != nil && api .config (). LatestFork ( data .ExecutionPayload .Timestamp ) >= forks .Prague {
458
- return nil , engine .UnsupportedFork . With ( errors . New ( "engine_getPayloadV3 is not available after Prague fork" ))
452
+ // Check if the payload timestamp falls within the Cancun fork timeframe
453
+ if data .ExecutionPayload != nil && ! api .checkFork ( data .ExecutionPayload .Timestamp , forks .Cancun ) {
454
+ return nil , engine .UnsupportedFork
459
455
}
460
456
return data , nil
461
457
}
@@ -470,9 +466,9 @@ func (api *ConsensusAPI) GetPayloadV4(payloadID engine.PayloadID) (*engine.Execu
470
466
if err != nil {
471
467
return nil , err
472
468
}
473
- // Check if the payload timestamp is greater or equal to Osaka activation timestamp
474
- if data .ExecutionPayload != nil && api .config (). LatestFork ( data .ExecutionPayload .Timestamp ) >= forks .Osaka {
475
- return nil , engine .UnsupportedFork . With ( errors . New ( "engine_getPayloadV4 is not available after Osaka fork" ))
469
+ // Check if the payload timestamp falls within the Prague fork timeframe
470
+ if data .ExecutionPayload != nil && ! api .checkFork ( data .ExecutionPayload .Timestamp , forks .Prague ) {
471
+ return nil , engine .UnsupportedFork
476
472
}
477
473
return data , nil
478
474
}
@@ -490,9 +486,9 @@ func (api *ConsensusAPI) GetPayloadV5(payloadID engine.PayloadID) (*engine.Execu
490
486
if err != nil {
491
487
return nil , err
492
488
}
493
- // Check if the payload timestamp falls within the time frame of the Osaka fork
489
+ // Check if the payload timestamp falls within the time frame of the Osaka fork or later
494
490
if data .ExecutionPayload != nil && api .config ().LatestFork (data .ExecutionPayload .Timestamp ) < forks .Osaka {
495
- return nil , engine .UnsupportedFork . With ( errors . New ( "engine_getPayloadV5 is not available before Osaka fork" ))
491
+ return nil , engine .UnsupportedFork
496
492
}
497
493
return data , nil
498
494
}
0 commit comments