-
Notifications
You must be signed in to change notification settings - Fork 67
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
Do the locking around Validator
state instead of on each member
#3163
base: albatross
Are you sure you want to change the base?
Conversation
info!("Initializing validator {}", validator.validator_address()); | ||
info!( | ||
"Initializing validator {}", | ||
validator.state().read().validator_address |
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.
validator.state().read().validator_address | |
validator.state().validator_address() |
This read()
is maybe not so nice, should I encapsulate that?
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 do not mind the .read()
here all that much, so from my end a change would not be necessary.
Can you add an explanation of why to the PR? |
This makes it easier to add new members, also, the individual locking did not really make sense because these shouldn't go out of sync.
9e0e58e
to
fbc8d13
Compare
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.
LGTM, just added a wish list item.
info!("Initializing validator {}", validator.validator_address()); | ||
info!( | ||
"Initializing validator {}", | ||
validator.state().read().validator_address |
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 do not mind the .read()
here all that much, so from my end a change would not be necessary.
consensus_state: Arc<RwLock<ConsensusState>>, | ||
validator_state: Option<InactivityState>, | ||
automatic_reactivate: Arc<AtomicBool>, | ||
|
||
macro_producer: Option<ProduceMacroBlock<TValidatorNetwork>>, | ||
macro_state: Arc<RwLock<Option<MacroState>>>, |
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.
This could be added to the ValidatorState
. Additionally that would open up a Rpc call to see the macro state which could be a very useful debugging tool.
This makes it easier to add new members, also, the individual locking did not really make sense because these shouldn't go out of sync.