Skip to content

Commit

Permalink
Merge pull request #572 from iotaledger/fix/notarization-race
Browse files Browse the repository at this point in the history
Fix race in notarization vs attestations
  • Loading branch information
alexsporn authored Nov 28, 2023
2 parents a88889e + adffefc commit 8c0c4c7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/protocol/engine/notarization/slotnotarization/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type Manager struct {
acceptedTimeFunc func() time.Time
apiProvider iotago.APIProvider

commitmentMutex syncutils.Mutex
commitmentMutex syncutils.RWMutex

module.Module
}
Expand Down Expand Up @@ -156,6 +156,9 @@ func (m *Manager) IsBootstrapped() bool {
}

func (m *Manager) notarizeAcceptedBlock(block *blocks.Block) (err error) {
m.commitmentMutex.RLock()
defer m.commitmentMutex.RUnlock()

if err = m.slotMutations.AddAcceptedBlock(block); err != nil {
return ierrors.Wrap(err, "failed to add accepted block to slot mutations")
}
Expand Down

0 comments on commit 8c0c4c7

Please sign in to comment.