-
Notifications
You must be signed in to change notification settings - Fork 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
Isolate forkchoice to blockchain package #12174
Conversation
a10b8bd
to
0b8f53e
Compare
@@ -484,3 +482,66 @@ func (s *Service) Ancestor(ctx context.Context, root []byte, slot primitives.Slo | |||
func (s *Service) SetGenesisTime(t time.Time) { | |||
s.genesisTime = t | |||
} | |||
|
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.
I think all these methods specific to forkchoice should be in their own file ex: forkchoice_chain_info
or something of that sort
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.
👍
) | ||
|
||
// SetGenesisTime sets the genesis time of beacon chain. | ||
func (s *Service) SetGenesisTime(t time.Time) { |
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.
Is this really a forkchoice method ? Seems unrelated
This PR isolates forkchoice to the blockchain package, this way consumers do not need to worry about locks.
In particular, it removes the function
ForkChoicer()
that exposed explicitly forkchoice to external packages.The blockchain package exposes an interface
blockchain.ForkchoiceFetcher
that wraps all externally used forkchoice functions in a self-locked manner. External callers do not have access to forkchoice directly, but rather have to call blockchain package to lock forkchoice..