Skip to content

Commit

Permalink
nodepeers testclient
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTylerHolmes committed Oct 21, 2023
1 parent 65f6d3b commit c234237
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions testclients/erroring.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,19 @@ func (s *Erroring) NodeSyncing(ctx context.Context) (*api.Response[*apiv1.SyncSt
return next.NodeSyncing(ctx)
}

// NodePeers provides the peers of the node
func (s *Erroring) NodePeers(ctx context.Context, opts *api.PeerOpts) (*api.Response[*apiv1.Peers], error) {
if err := s.maybeError(ctx); err != nil {
return nil, err
}
next, isNext := s.next.(consensusclient.NodePeersProvider)
if !isNext {
return nil, fmt.Errorf("%s@%s does not support this call", s.next.Name(), s.next.Address())
}

return next.NodePeers(ctx, opts)
}

// ProposerDuties obtains proposer duties for the given epoch.
func (s *Erroring) ProposerDuties(ctx context.Context,
opts *api.ProposerDutiesOpts,
Expand Down
11 changes: 11 additions & 0 deletions testclients/sleepy.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,17 @@ func (s *Sleepy) NodeSyncing(ctx context.Context) (*api.Response[*apiv1.SyncStat
return next.NodeSyncing(ctx)
}

// NodePeers provides the peers of the node
func (s *Sleepy) NodePeers(ctx context.Context, opts *api.PeerOpts) (*api.Response[*apiv1.Peers], error) {
s.sleep(ctx)
next, isNext := s.next.(consensusclient.NodePeersProvider)
if !isNext {
return nil, errors.New("next does not support this call")
}

return next.NodePeers(ctx, opts)
}

// ProposerDuties obtains proposer duties for the given epoch.
func (s *Sleepy) ProposerDuties(ctx context.Context,
opts *api.ProposerDutiesOpts,
Expand Down

0 comments on commit c234237

Please sign in to comment.