diff --git a/pkg/beacon/beacon.go b/pkg/beacon/beacon.go index 4cdcc3a..7c9d840 100644 --- a/pkg/beacon/beacon.go +++ b/pkg/beacon/beacon.go @@ -90,7 +90,7 @@ type Node interface { // FetchDepositSnapshot fetches the deposit snapshot. FetchDepositSnapshot(ctx context.Context) (*types.DepositSnapshot, error) // FetchBeaconCommittees fetches the committees for the given epoch at the given state. - FetchBeaconCommittees(ctx context.Context, state string, epoch phase0.Epoch) ([]*v1.BeaconCommittee, error) + FetchBeaconCommittees(ctx context.Context, state string, epoch *phase0.Epoch) ([]*v1.BeaconCommittee, error) // FetchAttestationData fetches the attestation data for the given slot and committee index. FetchAttestationData(ctx context.Context, slot phase0.Slot, committeeIndex phase0.CommitteeIndex) (*phase0.AttestationData, error) // FetchBeaconBlockBlobs fetches blob sidecars for the given block id. diff --git a/pkg/beacon/fetch.go b/pkg/beacon/fetch.go index 0133cf1..b78ddbc 100644 --- a/pkg/beacon/fetch.go +++ b/pkg/beacon/fetch.go @@ -230,16 +230,21 @@ func (n *node) FetchBeaconStateRoot(ctx context.Context, state string) (phase0.R return *rsp.Data, nil } -func (n *node) FetchBeaconCommittees(ctx context.Context, state string, epoch phase0.Epoch) ([]*v1.BeaconCommittee, error) { +func (n *node) FetchBeaconCommittees(ctx context.Context, state string, epoch *phase0.Epoch) ([]*v1.BeaconCommittee, error) { provider, isProvider := n.client.(eth2client.BeaconCommitteesProvider) if !isProvider { return nil, errors.New("client does not implement eth2client.BeaconCommitteesProvider") } - rsp, err := provider.BeaconCommittees(ctx, &api.BeaconCommitteesOpts{ + opts := &api.BeaconCommitteesOpts{ State: state, - Epoch: &epoch, - }) + } + + if epoch != nil { + opts.Epoch = epoch + } + + rsp, err := provider.BeaconCommittees(ctx, opts) if err != nil { return nil, err }