Skip to content

Commit

Permalink
Accept info.Peers args (#3515)
Browse files Browse the repository at this point in the history
  • Loading branch information
cam-schultz authored Nov 1, 2024
1 parent 7404ffe commit bcae9cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions api/info/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Client interface {
GetNetworkID(context.Context, ...rpc.Option) (uint32, error)
GetNetworkName(context.Context, ...rpc.Option) (string, error)
GetBlockchainID(context.Context, string, ...rpc.Option) (ids.ID, error)
Peers(context.Context, ...rpc.Option) ([]Peer, error)
Peers(context.Context, []ids.NodeID, ...rpc.Option) ([]Peer, error)
IsBootstrapped(context.Context, string, ...rpc.Option) (bool, error)
GetTxFee(context.Context, ...rpc.Option) (*GetTxFeeResponse, error)
Upgrades(context.Context, ...rpc.Option) (*upgrade.Config, error)
Expand Down Expand Up @@ -83,9 +83,11 @@ func (c *client) GetBlockchainID(ctx context.Context, alias string, options ...r
return res.BlockchainID, err
}

func (c *client) Peers(ctx context.Context, options ...rpc.Option) ([]Peer, error) {
func (c *client) Peers(ctx context.Context, nodeIDs []ids.NodeID, options ...rpc.Option) ([]Peer, error) {
res := &PeersReply{}
err := c.requester.SendRequest(ctx, "info.peers", struct{}{}, res, options...)
err := c.requester.SendRequest(ctx, "info.peers", &PeersArgs{
NodeIDs: nodeIDs,
}, res, options...)
return res.Peers, err
}

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/faultinjection/duplicate_node_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func checkConnectedPeers(tc tests.TestContext, existingNodes []*tmpnet.Node, new

// Collect the node ids of the new node's peers
infoClient := info.NewClient(newNode.URI)
peers, err := infoClient.Peers(tc.DefaultContext())
peers, err := infoClient.Peers(tc.DefaultContext(), nil)
require.NoError(err)
peerIDs := set.NewSet[ids.NodeID](len(existingNodes))
for _, peer := range peers {
Expand All @@ -81,7 +81,7 @@ func checkConnectedPeers(tc tests.TestContext, existingNodes []*tmpnet.Node, new

// Check that the new node is a peer
infoClient := info.NewClient(existingNode.URI)
peers, err := infoClient.Peers(tc.DefaultContext())
peers, err := infoClient.Peers(tc.DefaultContext(), nil)
require.NoError(err)
isPeer := false
for _, peer := range peers {
Expand Down

0 comments on commit bcae9cd

Please sign in to comment.