beacon/engine: omit empty witness in payload response (#31739)

Fixes https://github.com/ethereum/go-ethereum/issues/31737
This commit is contained in:
rjl493456442 2025-04-29 19:21:18 +08:00 committed by GitHub
parent a511553e44
commit 0ac4a84a1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -131,7 +131,7 @@ type executionPayloadEnvelopeMarshaling struct {
type PayloadStatusV1 struct {
Status string `json:"status"`
Witness *hexutil.Bytes `json:"witness"`
Witness *hexutil.Bytes `json:"witness,omitempty"`
LatestValidHash *common.Hash `json:"latestValidHash"`
ValidationError *string `json:"validationError"`
}

View file

@ -373,8 +373,11 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl
}
valid := func(id *engine.PayloadID) engine.ForkChoiceResponse {
return engine.ForkChoiceResponse{
PayloadStatus: engine.PayloadStatusV1{Status: engine.VALID, LatestValidHash: &update.HeadBlockHash},
PayloadID: id,
PayloadStatus: engine.PayloadStatusV1{
Status: engine.VALID,
LatestValidHash: &update.HeadBlockHash,
},
PayloadID: id,
}
}
if rawdb.ReadCanonicalHash(api.eth.ChainDb(), block.NumberU64()) != update.HeadBlockHash {