-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Change IP for local node connection to Loopback address #4373
Conversation
Thanks for opening this pull request! |
de4683a
to
375a2fd
Compare
If the local Bitcoin full node is bound to only listen on the loopback interface (127.0.0.1), attempting to open a socket to `InetAddress.getLocalHost()` - the return of which is variable but usually NOT 127.0.0.1 - will not work. Changing to `InetAddress.getLoopbackAddress()` resolves this.
375a2fd
to
a5cca0e
Compare
@dmos62 Could you please have a look at this? Thanks! |
Researched this a bit, but I'm still a bit fuzzy. As far as I can tell |
On my linux system, getLocalHost() returns 127.0.1.1 - the hosts file alias for my hostname. The typical usecase for getLocalHost() is to get the LAN address of the host (e.g. 192.168.1.x) but even that it does unreliably as evidenced by it giving 127.0.1.1 on my system. All of these addresses will connect to local machine so long as the listener is bound to all incoming addresses (0.0.0.0) rather than a specific interface. |
Hm, I'll lay out how I understand things, which conflict with some of the things you said:
In your situation, it seems like, the problem is that bitcoind is binding to a non-default loopback interface. Either reconfigure bitcoind, or change the default loopback interface by editing the hosts file. I am against the suggestion to query for a loopback address directly in Bisq, because it's undefined what loopback address it should return. The purpose of localhost is to define which loopback address is the default, so it's idiomatic to use it. |
Perhaps I have not been clear about what this PR fixes - my
|
What is the output of |
API Docs: http://cr.openjdk.java.net/~iris/se/11/build/latest/api/java.base/java/net/InetAddress.html |
That's the part I missed. I was confused why there's both a resolve localhost method and a get loopback interface method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. Behaviour being fixed is indeed a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK - based on #4373 (review)
Awesome work, congrats on your first merged pull request! |
If the local Bitcoin full node is bound to only listen on the loopback interface (127.0.0.1), attempting to open a socket to
InetAddress.getLocalHost()
- the return of which is variable but usually NOT 127.0.0.1 - will not work. Changing toInetAddress.getLoopbackAddress()
resolves this.