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

RFC: rpc: Remove dns argument for getaddednodeinfo #8097

Closed
wants to merge 1 commit into from

Conversation

theuni
Copy link
Member

@theuni theuni commented May 24, 2016

As discussed with @laanwj and @sdaftuar in Zurich. The output format is kept the same as before, though the input params change.

As far as I can tell, this has no test coverage, and I'm willing to bet it gets very little usage. The behavior is subtle and non-obvious: it does a real-time resolve in order to check whether an addnode entry is connected at the time of that resolve, and makes no mention of whether or not a connection once matched a resolved addnode.

This complicates the net encapsulation work, so I propose that we simply drop it unless there's a good reason not to. If preferred, it could swallow a dummy bool parameter, in order to remain api compatible.

It's hard to imagine a valid use-case for this, and the DNS resolve in rpc
is quite out of place.
@laanwj
Copy link
Member

laanwj commented May 26, 2016

Concept/ut ACK. This function was crazy, it shouldn't be doing DNS lookups in the RPC function. I also can't imagine this being useful to anyone.
API change needs mention in the release notes

@petertodd
Copy link
Contributor

Concept ACK

1 similar comment
@sipa
Copy link
Member

sipa commented May 26, 2016

Concept ACK

@theuni
Copy link
Member Author

theuni commented May 26, 2016

Ok, I'll add a mention in the notes and drop the RFC in the title.

@TheBlueMatt
Copy link
Contributor

Knowing whether or not your addnodes are connected is a useful feature, and not trivial from getpeerinfo. I certainly use this regularly.

On May 24, 2016 11:24:09 AM PDT, Cory Fields notifications@github.com wrote:

As discussed with @laanwj and @sdaftuar in Zurich. The output format is
kept the same as before, though the input params change.

As far as I can tell, this has no test coverage, and I'm willing to bet
it gets very little usage. The behavior is subtle and non-obvious: it
does a real-time resolve in order to check whether an addnode entry is
connected at the time of that resolve, and makes no mention of whether
or not a connection once matched a resolved addnode.

This complicates the net encapsulation work, so I propose that we
simply drop it unless there's a good reason not to. If preferred, it
could swallow a dummy bool parameter, in order to remain api
compatible.
You can view, comment on, or merge this pull request online at:

#8097

-- Commit Summary --

  • rpc: Remove dns argument for getaddednodeinfo

-- File Changes --

M src/rpc/net.cpp (86)

-- Patch Links --

https://github.com/bitcoin/bitcoin/pull/8097.patch
https://github.com/bitcoin/bitcoin/pull/8097.diff


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#8097

@sipa
Copy link
Member

sipa commented May 27, 2016

Can't we just check addrName to see whether we're connected to a particular addnode? That changes the question from "is there a connection whose IP corresponds to what name N currently refers to?" to "is there a connection to what N referred to at the time of connection?". I don't think that matters, or is it intended to migrate addnode'd connections even when the IP their name refers to changes?

@TheBlueMatt
Copy link
Contributor

TheBlueMatt commented May 27, 2016

We could, but thats a bit of an awkward question given the behavior of the auto-connect thread (which I do not think should change). If you change the question to that, then the background auto-connect thread may still spin trying to connect to/connecting to the host that was added, as its hostname has changed, even though the RPC will tell you you're connected.

@sipa
Copy link
Member

sipa commented May 27, 2016

Agree, the RPC and the thread should be consistent.

@theuni
Copy link
Member Author

theuni commented May 27, 2016

They're not consistent, though. If I call "getaddednodeinfo true", and there's a disconnected dns entry, it will resolve at that moment and return with a list of ip's. However, the connection thread re-resolves and attempts to connect up to 2 min later.

So when using a seednode here (the only plausible use-case I can imagine), the results won't match what the thread actually tries to connect to because the attempt could be minutes later. Odds are I'll find that it connected to an IP that wasn't in the previous list. So I'm not sure how the result is any more useful than dropping to a terminal and running dig.

Thinking more constructively: maybe the fix (which I think we might've discussed at one point) would be to have the pending connection attempts stored so that the rpc could grab them, rather than working in parallel.

I'm still not convinced that this is broadly useful, though I suppose the burden's on me to prove otherwise.

@TheBlueMatt Maybe it would be more helpful if you described your specific use-case?

@TheBlueMatt
Copy link
Contributor

I dont think this is useful for addnode'ing a seednode, indeed, but the use-case is allowing one to set a hostname to addnode, and then change the hostname freely, having the addnode follow the hostname as it changes. This is useful eg if you have a bunch of nodes which all addnode something, and you want to migrate the addnode'ed node.

@sipa sipa mentioned this pull request May 28, 2016
@laanwj
Copy link
Member

laanwj commented May 30, 2016

indeed, but the use-case is allowing one to set a hostname to addnode, and then change the hostname freely, having the addnode follow the hostname as it changes

This doesn't actually remove the functionality to do that.

Furthermore the getaddednodeinfo output is not stable in this case either, if the DNS entry changed from the time you connected to the time you call the RPC.

If you want this reporting it should be implemented differently: the original DNS lookup should store its result, it should not be repeated here.

@sipa
Copy link
Member

sipa commented May 30, 2016 via email

@laanwj
Copy link
Member

laanwj commented May 31, 2016

Closing in favor of #8113

@laanwj laanwj closed this May 31, 2016
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants