-
Notifications
You must be signed in to change notification settings - Fork 12
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
Initialize the DB with the GenesisState if the node is bootstrapping for the first time #1124
Conversation
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.
Only one thing I think should change, otherwise just some thought.
binary.Write(hasher, binary.BigEndian, gc.MaxBlockSize) | ||
binary.Write(hasher, binary.BigEndian, gc.JoinExpiry) | ||
binary.Write(hasher, binary.BigEndian, gc.VoteExpiry) | ||
binary.Write(hasher, binary.BigEndian, gc.DisabledGasCosts) | ||
binary.Write(hasher, binary.BigEndian, gc.MaxVotesPerTx) |
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.
One point about these, but not necessarily needing change: these are almost too convenient in that we can casually change the type of these and this code will not break, but the result will change, which is a consensus breaker. It's a lot more cumbersome to use the functions like binary.BigEndian.Append/PutUint64 etc, so let's go ahead with what you have now since we will certainly be changing gc
a lot before release, but at some point I think we should harden this code.
func (ce *ConsensusEngine) doBlockSync(ctx context.Context) error { | ||
if ce.role.Load() == types.RoleLeader { | ||
if len(ce.validators.GetValidators()) == 1 { | ||
// TODO: which validator set we should use here? whatever we have in the state? | ||
// what if the current validators are not the same as the ones in the state? |
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 don't think I understand the difference between "current validators" and "the ones in the state".
@@ -313,6 +316,8 @@ func New(cfg *Config) *ConsensusEngine { | |||
return ce | |||
} | |||
|
|||
var initialHeight int64 = 0 // TODO: get it from genesis? |
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.
Ah, good point. Yeah we should add this to the genesis config struct. Can do later though.
3da372a
to
633cd19
Compare
633cd19
to
1e55bcd
Compare
No description provided.