Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions x/sync/network_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,6 @@ func (c *networkClient) RequestAny(
// If the limit on active requests is reached, this function blocks until
// a slot becomes available.
func (c *networkClient) Request(ctx context.Context, nodeID ids.NodeID, request []byte) ([]byte, error) {
// TODO danlaine: is it possible for this condition to occur?
if nodeID == ids.EmptyNodeID {
return nil, fmt.Errorf("cannot send request to empty nodeID, nodeID=%s, requestLen=%d", nodeID, len(request))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a useful check to leave on the exported method, I think.
Even if all current uses are correct it might catch errors in future development.

Not very strongly opinionated, happy to defer to @dboehm-avalabs

}

// Take a slot from total [activeRequests] and block until a slot becomes available.
if err := c.activeRequests.Acquire(ctx, 1); err != nil {
return nil, ErrAcquiringSemaphore
Expand Down