Skip to content
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

fix(state/epoch): assign epoch 1 when block number is 0 #2592

Merged
merged 2 commits into from
Jun 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions dot/state/epoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,10 @@ func (s *EpochState) StoreBABENextConfigData(epoch uint64, hash common.Hash, nex
// check if the header is in the database then it's been finalized and
// thus we can also set the corresponding EpochData in the database
func (s *EpochState) FinalizeBABENextEpochData(finalizedHeader *types.Header) error {
if finalizedHeader.Number == 0 {
EclesioMeloJunior marked this conversation as resolved.
Show resolved Hide resolved
return nil
}

s.nextEpochDataLock.Lock()
defer s.nextEpochDataLock.Unlock()

Expand Down Expand Up @@ -597,6 +601,10 @@ func (s *EpochState) FinalizeBABENextEpochData(finalizedHeader *types.Header) er
// check if the header is in the database then it's been finalized and
// thus we can also set the corresponding NextConfigData in the database
func (s *EpochState) FinalizeBABENextConfigData(finalizedHeader *types.Header) error {
if finalizedHeader.Number == 0 {
return nil
}

s.nextConfigDataLock.Lock()
defer s.nextConfigDataLock.Unlock()

Expand Down