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

[common] Filter seed by features supported. #59

Conversation

vincenzopalazzo
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo commented Oct 3, 2021

This includes a rework of the PR #54, but does not include the refactoring in another module.

  • Support seed filtering by features
  • Admit DNS resolution error
  • Check the seed code for the Compact block flag

Closing #54
Fixes #50

Signed-off-by: Vincenzo Palazzo [email protected]

@vincenzopalazzo vincenzopalazzo mentioned this pull request Oct 3, 2021
4 tasks
@vincenzopalazzo vincenzopalazzo force-pushed the vincenzopalazzo/filter_dns2 branch from 4272bd8 to 623b4c8 Compare October 8, 2021 12:24
common/src/network.rs Outdated Show resolved Hide resolved
@vincenzopalazzo vincenzopalazzo force-pushed the vincenzopalazzo/filter_dns2 branch from 623b4c8 to 7440a40 Compare October 10, 2021 07:25
@vincenzopalazzo vincenzopalazzo marked this pull request as ready for review October 10, 2021 09:14
common/src/network.rs Outdated Show resolved Hide resolved
@vincenzopalazzo vincenzopalazzo force-pushed the vincenzopalazzo/filter_dns2 branch from 2c2bd89 to 173fb35 Compare October 19, 2021 04:56
@vincenzopalazzo vincenzopalazzo force-pushed the vincenzopalazzo/filter_dns2 branch 6 times, most recently from e6eaca9 to 3cb277a Compare November 2, 2021 15:47
@vincenzopalazzo
Copy link
Collaborator Author

If you give me the ack on this PR I will squash the commit it only one and I will change the comment message with a better description, to avoid closing the PR and open another one, if you agree.

@vincenzopalazzo vincenzopalazzo force-pushed the vincenzopalazzo/filter_dns2 branch 3 times, most recently from 0de2c42 to 0727274 Compare November 8, 2021 21:57
@vincenzopalazzo vincenzopalazzo force-pushed the vincenzopalazzo/filter_dns2 branch 3 times, most recently from 9f8968f to d217041 Compare November 15, 2021 22:54
@vincenzopalazzo vincenzopalazzo force-pushed the vincenzopalazzo/filter_dns2 branch from d217041 to d6f3e2b Compare November 27, 2021 08:13
@vincenzopalazzo vincenzopalazzo force-pushed the vincenzopalazzo/filter_dns2 branch from d6f3e2b to 8c6e7c3 Compare December 4, 2021 21:21
This include a rework of the PR cloudhead#54, but not include the refactoring in other module.

Signed-off-by: Vincenzo Palazzo <[email protected]>
The following commit include the combination of the two flags, but the resolution has the following result on mainet

```
2021-10-10T10:11:46.433+02:00 DEBUG nakamoto_common::p2p::peer Resolving DNS seed ("x41.seed.bitcoin.sipa.be", 8333)
2021-10-10T10:11:46.790+02:00 DEBUG nakamoto_common::p2p::peer Error received is failed to lookup address information: Name or service not known
2021-10-10T10:11:46.790+02:00 DEBUG nakamoto_common::p2p::peer Resolving DNS seed ("x41.dnsseed.bluematt.me", 8333)
2021-10-10T10:11:47.409+02:00 DEBUG nakamoto_common::p2p::peer Error received is failed to lookup address information: Name or service not known
2021-10-10T10:11:47.409+02:00 DEBUG nakamoto_common::p2p::peer Resolving DNS seed ("x41.dnsseed.bitcoin.dashjr.org", 8333)
2021-10-10T10:11:47.612+02:00 DEBUG nakamoto_common::p2p::peer Error received is failed to lookup address information: Name or service not known
2021-10-10T10:11:47.612+02:00 DEBUG nakamoto_common::p2p::peer Resolving DNS seed ("x41.seed.bitcoinstats.com", 8333)
2021-10-10T10:11:47.664+02:00 DEBUG nakamoto_common::p2p::peer Resolving DNS seed ("x41.seed.bitcoin.jonasschnelli.ch", 8333)
2021-10-10T10:11:47.920+02:00 DEBUG nakamoto_common::p2p::peer Error received is failed to lookup address information: Name or service not known
2021-10-10T10:11:47.920+02:00 DEBUG nakamoto_common::p2p::peer Resolving DNS seed ("x41.seed.btc.petertodd.org", 8333)
2021-10-10T10:11:47.959+02:00 DEBUG nakamoto_common::p2p::peer Error received is failed to lookup address information: Name or service not known
2021-10-10T10:11:47.959+02:00 DEBUG nakamoto_common::p2p::peer Resolving DNS seed ("x41.seed.bitcoin.sprovoost.nl", 8333)
2021-10-10T10:11:48.086+02:00 DEBUG nakamoto_common::p2p::peer Error received is failed to lookup address information: Name or service not known
2021-10-10T10:11:48.086+02:00 DEBUG nakamoto_common::p2p::peer Resolving DNS seed ("x41.dnsseed.emzy.de", 8333)
2021-10-10T10:11:49.048+02:00 DEBUG nakamoto_common::p2p::peer Error received is failed to lookup address information: Name or service not known
2021-10-10T10:11:49.048+02:00 DEBUG nakamoto_common::p2p::peer Resolving DNS seed ("x41.seed.bitcoin.wiz.biz", 8333)
2021-10-10T10:11:49.828+02:00 DEBUG nakamoto_common::p2p::peer Error received is failed to lookup address information: Name or service not known
2021-10-10T10:11:49.828+02:00 DEBUG nakamoto_common::p2p::peer Resolving DNS seed ("x41.seed.cloudhead.io", 8333)
2021-10-10T10:11:49.908+02:00 DEBUG nakamoto_common::p2p::peer Error received is failed to lookup address information: Name or service not known

```

In case of resolution failure, we need also to check the single feature here in some order of importance for nakamoto?

Signed-off-by: Vincenzo Palazzo <[email protected]>
Adding some rules on the vector of seed returned by the network.
Signed-off-by: Vincenzo Palazzo <[email protected]>
@vincenzopalazzo vincenzopalazzo force-pushed the vincenzopalazzo/filter_dns2 branch from 8c6e7c3 to eb5b360 Compare December 6, 2021 22:24
Copy link
Collaborator Author

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

This PR contains a wrong solution right @cloudhead ?

Comment on lines +54 to +55
while let Some(seed) = seeds.next() {
debug!("Resolving DNS seed {:?}", seed);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this PR it is not completed, because I'm missing the services flag that it is Supported by the network

Here there is still the services flag none, and this it wrong I think

match seed.to_socket_addrs() {
                Ok(addrs) => {
                    success = true;
                    for addr in addrs {
                        self.insert(
                            addr.ip(),
                            KnownAddress::new(
                                Address::new(&addr, ServiceFlags::NONE),
                                source,
                                None,
                            ),
                        );
                    }

Maybe this solution proposed is totally wrong because I'm missing the services flag in the address. Mh!

@vincenzopalazzo
Copy link
Collaborator Author

This required another iteration, closing for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support service bit filtering
2 participants