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

update peer host to parse dns instead of ip #5533

Merged
merged 6 commits into from
Jan 2, 2025

Conversation

ASuciuX
Copy link
Contributor

@ASuciuX ASuciuX commented Dec 4, 2024

Following the flow of the self.connect() function you can see that it is trying to open a TCP connection with net::TcpStream::connect((self.config.peer_host.as_str(), self.config.peer_port). If the peer_host is a DNS, it automatically tries to connect to the IPs paired to the DNS.

   #[stable(feature = "rust1", since = "1.0.0")]
    pub fn connect<A: ToSocketAddrs>(addr: A) -> io::Result<TcpStream> {
        super::each_addr(addr, net_imp::TcpStream::connect).map(TcpStream)
    }

The error was occurring because the DNS was converted directly into ipv4 address at the moment of reading the data from the config file. Afterwards, it didn’t have the DNS linked as it was only keeping the ipv4 address.

I've run the integration test suite and all of them passed. Please let me know if there is anything else I could run to check this.

❯ BITCOIND_TEST=1 RUST_BACKTRACE=full cargo nextest run --test-threads 1 --package stacks-node

So the solution applied here is to keep the DNS instead of converting it to ipv4 and it will automatically reconnect successfully.

@ASuciuX ASuciuX requested a review from a team as a code owner December 4, 2024 18:30
jcnelson
jcnelson previously approved these changes Dec 11, 2024
@ASuciuX ASuciuX requested a review from wileyj December 17, 2024 15:43
wileyj
wileyj previously approved these changes Dec 17, 2024
@wileyj
Copy link
Collaborator

wileyj commented Dec 17, 2024

ahh just notifed this @ASuciuX but there is a merge conflict that needs to be resolved.

@wileyj wileyj self-requested a review December 17, 2024 20:15
@ASuciuX ASuciuX dismissed stale reviews from wileyj and jcnelson via 9ace73c December 18, 2024 16:15
@ASuciuX
Copy link
Contributor Author

ASuciuX commented Dec 18, 2024

Thank you @wileyj. The file was moved from stacks-node to stackslib, I've updated it.

@wileyj wileyj requested a review from a team December 18, 2024 16:45
@jcnelson jcnelson self-requested a review December 20, 2024 02:50
@wileyj wileyj added this pull request to the merge queue Dec 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Dec 20, 2024
@jcnelson jcnelson added this pull request to the merge queue Jan 2, 2025
Merged via the queue into develop with commit c2f5f59 Jan 2, 2025
1 check passed
@blockstack-devops
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@stacks-network stacks-network locked as resolved and limited conversation to collaborators Jan 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

burnchain connection retry should periodically perform another DNS lookup
4 participants