mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
beacon/blsync: fix engine API version selection
This commit is contained in:
parent
05365d8538
commit
c30a25a282
1 changed files with 14 additions and 14 deletions
|
|
@ -101,7 +101,16 @@ func (ec *engineClient) callNewPayload(fork string, event types.ChainHeadEvent)
|
||||||
params = []any{execData}
|
params = []any{execData}
|
||||||
)
|
)
|
||||||
switch fork {
|
switch fork {
|
||||||
case "electra":
|
case "altair", "bellatrix":
|
||||||
|
method = "engine_newPayloadV1"
|
||||||
|
case "capella":
|
||||||
|
method = "engine_newPayloadV2"
|
||||||
|
case "deneb":
|
||||||
|
method = "engine_newPayloadV3"
|
||||||
|
parentBeaconRoot := event.BeaconHead.ParentRoot
|
||||||
|
blobHashes := collectBlobHashes(event.Block)
|
||||||
|
params = append(params, blobHashes, parentBeaconRoot)
|
||||||
|
default: // electra, fulu and above
|
||||||
method = "engine_newPayloadV4"
|
method = "engine_newPayloadV4"
|
||||||
parentBeaconRoot := event.BeaconHead.ParentRoot
|
parentBeaconRoot := event.BeaconHead.ParentRoot
|
||||||
blobHashes := collectBlobHashes(event.Block)
|
blobHashes := collectBlobHashes(event.Block)
|
||||||
|
|
@ -110,15 +119,6 @@ func (ec *engineClient) callNewPayload(fork string, event types.ChainHeadEvent)
|
||||||
hexRequests[i] = hexutil.Bytes(event.ExecRequests[i])
|
hexRequests[i] = hexutil.Bytes(event.ExecRequests[i])
|
||||||
}
|
}
|
||||||
params = append(params, blobHashes, parentBeaconRoot, hexRequests)
|
params = append(params, blobHashes, parentBeaconRoot, hexRequests)
|
||||||
case "deneb":
|
|
||||||
method = "engine_newPayloadV3"
|
|
||||||
parentBeaconRoot := event.BeaconHead.ParentRoot
|
|
||||||
blobHashes := collectBlobHashes(event.Block)
|
|
||||||
params = append(params, blobHashes, parentBeaconRoot)
|
|
||||||
case "capella":
|
|
||||||
method = "engine_newPayloadV2"
|
|
||||||
default:
|
|
||||||
method = "engine_newPayloadV1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5)
|
ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5)
|
||||||
|
|
@ -145,12 +145,12 @@ func (ec *engineClient) callForkchoiceUpdated(fork string, event types.ChainHead
|
||||||
|
|
||||||
var method string
|
var method string
|
||||||
switch fork {
|
switch fork {
|
||||||
case "deneb", "electra":
|
case "altair", "bellatrix":
|
||||||
method = "engine_forkchoiceUpdatedV3"
|
method = "engine_forkchoiceUpdatedV1"
|
||||||
case "capella":
|
case "capella":
|
||||||
method = "engine_forkchoiceUpdatedV2"
|
method = "engine_forkchoiceUpdatedV2"
|
||||||
default:
|
default: // deneb, electra, fulu and above
|
||||||
method = "engine_forkchoiceUpdatedV1"
|
method = "engine_forkchoiceUpdatedV3"
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5)
|
ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue