Open digiront opened 6 years ago
Based on this comment https://github.com/Zilliqa/Zilliqa/pull/326#issuecomment-398008302 this improvement also applies to
DirectoryService::SetState
ConsensusLeader
(no setState here)ConsecusBackup
(no setState here)
Problem
Regarding this:
Setting a new state always succeeds. This implies it's the caller's responsibility to verify the state transition before calling
Node::setState
.Suggestion
A state machine would simplify all
setState
callers by abstracting away the state transition logic. Given such a state machine, the caller just needs to know if the state was changed successfully. Another benefit is that this would simplify testing.Resources