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

add lock to purgeMilestoneIDsList #10493

Merged
merged 3 commits into from
May 28, 2024
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
4 changes: 4 additions & 0 deletions polygon/bor/finality/whitelist/milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func (m *milestone) UnlockSprint(endBlockNum uint64) {
}

m.Locked = false

m.purgeMilestoneIDsList()

err := rawdb.WriteLockField(m.db, m.Locked, m.LockedMilestoneNumber, m.LockedMilestoneHash, m.LockedMilestoneIDs)
Expand Down Expand Up @@ -213,6 +214,9 @@ func (m *milestone) GetMilestoneIDsList() []string {

// This is remove the milestoneIDs stored in the list.
func (m *milestone) purgeMilestoneIDsList() {
m.finality.Lock()
defer m.finality.Unlock()

m.LockedMilestoneIDs = make(map[string]struct{})
}

Expand Down
Loading