Skip to content

Commit

Permalink
Error handling to beacon chain gossip (erigontech#7132)
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 authored and calmbeing committed Apr 24, 2023
1 parent 2f97707 commit 8be0477
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cl/cltypes/ssz/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 uint32, max uint6
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 8be0477

Please sign in to comment.