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

Collect and send more accurate peer addresses #2123

Merged
merged 3 commits into from
May 18, 2021
Merged

Collect and send more accurate peer addresses #2123

merged 3 commits into from
May 18, 2021

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented May 7, 2021

Motivation

This PR improves integration test coverage for #2120.

To improve the quality of its address book, Zebra can collect canonical addresses from inbound peers.

To get inbound connections, Zebra can send its own address to its peers when they ask for addresses.

Solution

  • add canonical addresses from inbound peers to the address book
  • send our own address when peers ask for addresses

The code in this pull request has:

  • Documentation Comments
  • Integration Tests
  • Manual Tests

Review

Anyone can review this peer address book quality improvement. It is a routine enhahcement.

Related Issues

This fix is based on #2121. GitHub will automatically rebase it to main once #2121 merges.

These address quality improvements are part of the follow-up to #2120. They implement part of #1892.

@teor2345 teor2345 added A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement P-Medium A-network Area: Network protocol updates or fixes labels May 7, 2021
@teor2345 teor2345 requested a review from a team May 7, 2021 02:02
@teor2345 teor2345 self-assigned this May 7, 2021
@teor2345 teor2345 force-pushed the verack-after-check branch from 3494e9b to 32616ec Compare May 7, 2021 02:20
@teor2345 teor2345 force-pushed the verack-after-check branch from 32616ec to 315a32b Compare May 7, 2021 03:00
@teor2345 teor2345 marked this pull request as draft May 7, 2021 06:05
@teor2345
Copy link
Contributor Author

teor2345 commented May 7, 2021

Marking as draft until #2121 merges

@teor2345 teor2345 force-pushed the verack-after-check branch from 315a32b to 66abfbe Compare May 16, 2021 08:41
Base automatically changed from verack-after-check to main May 17, 2021 20:39
teor2345 added 2 commits May 18, 2021 08:11
Add canonical addresses from inbound connections to the address book,
so that Zebra can use them for reconnection attempts.

Use the newly added `NeverAttemptedAlternate` state for these addresses,
so we try gossiped addresses first, then canonical addresses. This avoids
duplicate connections to inbound peers.
When peers ask for peer addresses, add our local listener address to the
set of addresses, sanitize, then truncate. Sanitize shuffles addresses,
so if there are lots of addresses in the address book, our address will
only be sent to some peers.
@teor2345 teor2345 marked this pull request as ready for review May 17, 2021 22:11
@teor2345 teor2345 enabled auto-merge (rebase) May 17, 2021 22:12
@dconnolly
Copy link
Contributor

One small q before approval

Co-authored-by: teor <teor@riseup.net>
@teor2345 teor2345 merged commit bf72d6d into main May 18, 2021
@teor2345 teor2345 deleted the more-peer-addr branch May 18, 2021 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-network Area: Network protocol updates or fixes A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants