Skip to content

Commit

Permalink
fix block extra data helper for electra
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Jun 15, 2024
1 parent 493c175 commit 34d2277
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion indexer/block_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ func GetExecutionExtraData(v *spec.VersionedSignedBeaconBlock) ([]byte, error) {
return v.Capella.Message.Body.ExecutionPayload.ExtraData, nil
case spec.DataVersionDeneb:
if v.Deneb == nil || v.Deneb.Message == nil || v.Deneb.Message.Body == nil || v.Deneb.Message.Body.ExecutionPayload == nil {
return nil, errors.New("no denb block")
return nil, errors.New("no deneb block")
}

return v.Deneb.Message.Body.ExecutionPayload.ExtraData, nil
case spec.DataVersionElectra:
if v.Electra == nil || v.Electra.Message == nil || v.Electra.Message.Body == nil || v.Electra.Message.Body.ExecutionPayload == nil {
return nil, errors.New("no electra block")
}

return v.Electra.Message.Body.ExecutionPayload.ExtraData, nil
default:
return nil, errors.New("unknown version")
}
Expand Down

0 comments on commit 34d2277

Please sign in to comment.