Skip to content

Conversation

@danlaine
Copy link

Why this should be merged

The node ID should never be empty

How this works

Self explanatory

How this was tested

Existing UT

@danlaine danlaine requested a review from darioush as a code owner April 14, 2023 14:47
@danlaine danlaine self-assigned this Apr 14, 2023
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

@danlaine danlaine merged commit 319f38b into dev Apr 21, 2023
@danlaine danlaine deleted the sync-remove-check-for-impossible-condition branch April 21, 2023 19:55
@patrick-ogrady patrick-ogrady added this to the v1.10.1 milestone Apr 28, 2023
maru-ava pushed a commit that referenced this pull request Nov 20, 2025
Signed-off-by: Jonathan Oppenheimer <[email protected]>
Co-authored-by: Austin Larson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants