Skip to content

Commit

Permalink
Error handling to beacon chain gossip (#7132)
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 authored and Alexey Sharp committed Mar 28, 2023
1 parent b8eaf78 commit beb9778
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cl/cltypes/ssz_utils/ssz.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ func DecodeDynamicList[T Unmarshaler](bytes []byte, start, end, max uint32) ([]T
return nil, ErrBadOffset
}
objs[i] = objs[i].Clone().(T)
objs[i].DecodeSSZ(buf[currentOffset:endOffset])
if err := objs[i].DecodeSSZ(buf[currentOffset:endOffset]); err != nil {
return nil, err
}
currentOffset = endOffset
}
return objs, nil
Expand All @@ -121,7 +123,9 @@ func DecodeStaticList[T Unmarshaler](bytes []byte, start, end, bytesPerElement u
objs := make([]T, elementsNum)
for i := range objs {
objs[i] = objs[i].Clone().(T)
objs[i].DecodeSSZ(buf[i*int(bytesPerElement):])
if err := objs[i].DecodeSSZ(buf[i*int(bytesPerElement):]); err != nil {
return nil, err
}
}
return objs, nil
}
Expand Down

0 comments on commit beb9778

Please sign in to comment.