Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 'ipfs routing findpeer' explicitly fails when searching for self #9903

Merged
merged 2 commits into from
Jun 1, 2023

Conversation

susarlanikhilesh
Copy link
Contributor

@susarlanikhilesh susarlanikhilesh commented May 30, 2023

Closes #9898

@BigLep
Copy link
Contributor

BigLep commented May 30, 2023

@hacdias : can you provide a quick review please?

Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

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

Seems fine, but perhaps a test would be great.

@susarlanikhilesh
Copy link
Contributor Author

Not sure on how to write a test case for that scenario itself as we need the daemon running while we want to test this command. Any leads would be great.

Thank you

@hacdias
Copy link
Member

hacdias commented May 30, 2023

@susarlanikhilesh you can write a test inside test/cli. Those tests all use a daemon. Perhaps this file would be the best to insert a t.Run("ipfs routing findpeer fails for self", func(t *testing.T) { }) or something like that: https://github.com/ipfs/kubo/blob/master/test/cli/routing_dht_test.go

@hacdias hacdias changed the title add self search in dht not supported fix: 'ipfs routing findpeer' explicitly fails when searching for self May 30, 2023
@susarlanikhilesh
Copy link
Contributor Author

@hacdias Can you please check if that's sufficient.

@@ -301,6 +301,10 @@ var findPeerRoutingCmd = &cmds.Command{
return err
}

if pid == nd.Identity {
return ErrSelfUnsupported
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this works but this seems very ad-hoc.
I think this is covering up a bug, ideally the routing layers like dht, ... would return this error.

This is better than nothing still.

Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

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

Thanks for this!

@hacdias hacdias merged commit 6eef0b4 into ipfs:master Jun 1, 2023
@susarlanikhilesh susarlanikhilesh deleted the feature/self-dht-err branch June 14, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Make clear that finding your own node in the DHT is currently not supported
4 participants