Skip to content

Commit

Permalink
fix: PRT - validate epoch updater is not already stored (#1730)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranlavanet authored Oct 8, 2024
1 parent a3e095b commit d1da119
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions protocol/statetracker/updaters/epoch_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ func NewEpochUpdater(stateQuery EpochStateQueryInterface) *EpochUpdater {
func (eu *EpochUpdater) RegisterEpochUpdatable(ctx context.Context, epochUpdatable EpochUpdatable, blocksUpdateDelay int64) {
eu.lock.Lock()
defer eu.lock.Unlock()
// validate we do not store the same updatable twice
for _, epochUpdatableStored := range eu.epochUpdatables {
if epochUpdatable == epochUpdatableStored.EpochUpdatable {
return
}
}
// initialize with the current epoch
currentEpoch, err := eu.stateQuery.CurrentEpochStart(ctx)
if err != nil {
Expand Down

0 comments on commit d1da119

Please sign in to comment.