Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Commit

Permalink
Refactor: removed unused cleaning of pending attestations
Browse files Browse the repository at this point in the history
  • Loading branch information
hmoog committed Nov 8, 2023
1 parent f011a66 commit fb019ee
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions pkg/protocol/engine/attestation/slotattestation/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package slotattestation
import (
"github.com/iotaledger/hive.go/ads"
"github.com/iotaledger/hive.go/core/memstorage"
"github.com/iotaledger/hive.go/ds/shrinkingmap"
"github.com/iotaledger/hive.go/ierrors"
"github.com/iotaledger/hive.go/kvstore"
"github.com/iotaledger/hive.go/runtime/module"
Expand Down Expand Up @@ -325,18 +324,8 @@ func (m *Manager) Reset() {
m.commitmentMutex.Lock()
defer m.commitmentMutex.Unlock()

// only reset future attestations as pending ones are only updated on commitment and accordingly in a "clean state".
m.futureAttestations.Clear()

pendingAttestationsToClear := make([]iotago.SlotIndex, 0)
m.pendingAttestations.ForEach(func(slot iotago.SlotIndex, _ *shrinkingmap.ShrinkingMap[iotago.AccountID, *iotago.Attestation]) {
if slot > m.lastCommittedSlot {
pendingAttestationsToClear = append(pendingAttestationsToClear, slot)
}
})

for _, slot := range pendingAttestationsToClear {
m.pendingAttestations.Evict(slot)
}
}

func (m *Manager) computeAttestationCommitmentOffset(slot iotago.SlotIndex) (cutoffSlot iotago.SlotIndex, isValid bool) {
Expand Down

0 comments on commit fb019ee

Please sign in to comment.