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.
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
refactor: split census into multiple types #1510
refactor: split census into multiple types #1510
Changes from 1 commit
aa32159
96dfc35
6856143
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
nit is it worth adding an
else
here with apanic
/error!
? maybe not bc it'll get a bit convoluted, but then if we don't need anelse
do we need thisif
? there shouldn't be a case where we try to process a peer from an unactivated subnetwork... but this is very much a nit, fine to leave as isThere 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.
I think there might be misunderstanding.
The
if
is not part of the regular code flow, but the special syntax fortokio::select!
(more details here), and there isn't an option forelse
.Unless you were thinking about
else
case of thetokio::select!
statement, but then the comment doesn't make sense because code would already panic ifelse
is not present and code execution would go there.With the current implementation, this can happen if no subnetworks were provided in the
init
function, and now I added a check for that as well.The
if
statements are needed with the current implementation becausepeer_to_process()
would returnNone
for uninitialized networks, forcing them to re-initialize and we don't want that for non-enabled subnetworks.The original implementation was using selectors like this:
(basically ignoring those
None
values) and re-initialization would be triggered whenget_interested_enrs()
would fail, causing that request to take much longer but still return empty set of enrs.I believe that re-initialization should be detected and done as part of the regular census maintenance (and not be triggered by
get_interested_enrs
), and this is the cleanest way I found to do it.I'm not sure if my explanation is clear. I think good understanding of what
tokio::select!
does under the hood is very important here, and I'm not sure how well I was able to explain my reasoning around it.