ssvlabs/ssv-spec

Get rid of the `GetShare` pattern that loops over share map

GalRogozinski opened this issue · 1 comments

Description

We have places in code where we assume that the first share has common properties with all other committee shares.
So we extract the first share to get the data.
Even though correct, this is hacky, and we shouldn't do this.

e.g.

// Get committee (unique for runner)
var shareSample *types.Share
for _, share := range b.Share {
shareSample = share
break
}
if shareSample == nil {
return errors.New("can not get committee because there is no share in runner")
}
committee := shareSample.Committee

#464 is one way of doing it