Error handling to beacon chain gossip (#7132)

This commit is contained in:
Giulio rebuffo 2023-03-18 18:15:59 +01:00 committed by Alexey Sharp
parent b8eaf78b17
commit beb97784d4

View File

@ -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
@ -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
}