Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this fix?
This fixes a regression introduced with the cached router.
Because the
cachedRouter
was wrappingsanitizeRouter
, any providers that has no addresses, were thus getting populated straight from cache without going throughsanitizeRouter
.This resulted in us returning providers with private IPs.
How does this fix
This PR ensures that whatever the cached router spews out, gets properly sanitised.
Open question
sanitizeRouter
removes private IPs, but it doesn't remove records that have no IPs. In theory, there's might be an edge case where we find records that only contain private IPs, that are then removed bysanitizeRouter
, leading frontends/consumers of this to issue a subsequent calls. This seems pretty unlikely.dht.FindPeer
with only private IPs (if you're connecting to Amino)?sanitizeRouter
, but it seems like this might be unnecessary work.