Compare with nil before invoking IsNil() on an interface (#14431)

* Compare with nil before invoking `IsNil()` on an interface

* changelog

* review
This commit is contained in:
Radosław Kapka
2024-09-06 15:39:33 -04:00
committed by GitHub
parent eec3b0b7fe
commit 62b8e63a0a
10 changed files with 15 additions and 17 deletions

View File

@@ -526,7 +526,7 @@ func (s *Service) ReconstructFullBellatrixBlockBatch(
func fullPayloadFromPayloadBody(
header interfaces.ExecutionData, body *pb.ExecutionPayloadBody, bVersion int,
) (interfaces.ExecutionData, error) {
if header.IsNil() || body == nil {
if header == nil || header.IsNil() || body == nil {
return nil, errors.New("execution block and header cannot be nil")
}

View File

@@ -67,7 +67,7 @@ func (r *blindedBlockReconstructor) addToBatch(b interfaces.ReadOnlySignedBeacon
if err != nil {
return err
}
if header.IsNil() {
if header == nil || header.IsNil() {
return errors.New("execution payload header in blinded block was nil")
}
r.orderedBlocks = append(r.orderedBlocks, &blockWithHeader{block: b, header: header})