-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Register Subscribers After Node Is Synced #7468
Conversation
beacon-chain/sync/service.go
Outdated
// Exit once we received the synced event. | ||
stateSub.Unsubscribe() |
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.
When you return, deferred stateSub.Unsubscribe()
will be called.
I guess there is double unsubscribe in the original implementation as well?
Nishant, per your request to pre-review: except for that double unsubscribe (which, I guess, is a no-op, on the second invocation) everything looks solid. |
Codecov Report
@@ Coverage Diff @@
## master #7468 +/- ##
=======================================
Coverage 60.65% 60.65%
=======================================
Files 426 426
Lines 30384 30384
=======================================
Hits 18430 18430
Misses 8954 8954
Partials 3000 3000 |
} | ||
log.WithField("starttime", startTime).Debug("Chain started in sync service") | ||
s.chainStarted = true | ||
}() |
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.
Do you need to return after this go routine? Otherwise it's still in the for loop, right?
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.
We need it to continue looping as we also need to receive the synced event before
exiting.
What type of PR is this?
Feature Addition
What does this PR do? Why is it needed?
As part of #6622 , we will need to enable gossip scoring. However gossip peer scoring relies on unsynced nodes staying out
of the mesh until they are synced. This PR registers the relevant subscribers later, and only joins the mesh for the relevant topics after the node is synced.
Which issues(s) does this PR fix?
N.A
Other notes for review