@@ -447,21 +447,28 @@ func (api *ConsensusAPI) NewPayloadV1(params engine.ExecutableData) (engine.Payl
447
447
448
448
// NewPayloadV2 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.
449
449
func (api * ConsensusAPI ) NewPayloadV2 (params engine.ExecutableData ) (engine.PayloadStatusV1 , error ) {
450
- if params .Withdrawals == nil {
451
- return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil withdrawals post-shanghai" ))
452
- }
453
- if params .ExcessBlobGas != nil {
454
- return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("non-nil excessBlobGas pre-cancun" ))
455
- }
456
- if params .BlobGasUsed != nil {
457
- return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil params.BlobGasUsed pre-cancun" ))
458
- }
459
-
460
450
c := api .eth .BlockChain ().Config ()
461
- if ! active (c .IsShanghai , c .IsCancun , c .LondonBlock , params .Timestamp ) {
462
- return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .UnsupportedFork .With (errors .New ("newPayloadV2 must only be called for shanghai payloads" ))
451
+ if active (c .IsShanghai , c .IsCancun , c .LondonBlock , params .Timestamp ) {
452
+ if params .Withdrawals == nil {
453
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("nil withdrawals post-shanghai" ))
454
+ }
455
+ if params .ExcessBlobGas != nil {
456
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("non-nil excessBlobGas pre-cancun" ))
457
+ }
458
+ if params .BlobGasUsed != nil {
459
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("non-nil params.BlobGasUsed pre-cancun" ))
460
+ }
461
+ } else {
462
+ if params .Withdrawals != nil {
463
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("non-nil withdrawals pre-shanghai" ))
464
+ }
465
+ if params .ExcessBlobGas != nil {
466
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("non-nil excessBlobGas pre-cancun" ))
467
+ }
468
+ if params .BlobGasUsed != nil {
469
+ return engine.PayloadStatusV1 {Status : engine .INVALID }, engine .InvalidParams .With (errors .New ("non-nil params.BlobGasUsed pre-cancun" ))
470
+ }
463
471
}
464
-
465
472
return api .newPayload (params , nil , nil )
466
473
}
467
474
0 commit comments