Skip to content

Commit beb9778

Browse files
Giulio2002Alexey Sharp
authored andcommitted
Error handling to beacon chain gossip (erigontech#7132)
1 parent b8eaf78 commit beb9778

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cl/cltypes/ssz_utils/ssz.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ func DecodeDynamicList[T Unmarshaler](bytes []byte, start, end, max uint32) ([]T
9999
return nil, ErrBadOffset
100100
}
101101
objs[i] = objs[i].Clone().(T)
102-
objs[i].DecodeSSZ(buf[currentOffset:endOffset])
102+
if err := objs[i].DecodeSSZ(buf[currentOffset:endOffset]); err != nil {
103+
return nil, err
104+
}
103105
currentOffset = endOffset
104106
}
105107
return objs, nil
@@ -121,7 +123,9 @@ func DecodeStaticList[T Unmarshaler](bytes []byte, start, end, bytesPerElement u
121123
objs := make([]T, elementsNum)
122124
for i := range objs {
123125
objs[i] = objs[i].Clone().(T)
124-
objs[i].DecodeSSZ(buf[i*int(bytesPerElement):])
126+
if err := objs[i].DecodeSSZ(buf[i*int(bytesPerElement):]); err != nil {
127+
return nil, err
128+
}
125129
}
126130
return objs, nil
127131
}

0 commit comments

Comments
 (0)