fix(protocol): crash in concurrent map write/read

This commit is contained in:
Ivan Belyakov 2024-02-05 14:37:56 +01:00 committed by IvanBelyakoff
parent 2dc1b48968
commit 33c46dd59d
1 changed files with 3 additions and 0 deletions

View File

@ -123,6 +123,9 @@ func (m *EnvelopesMonitor) Add(identifiers [][]byte, envelopeHashes []types.Hash
return errors.New("hashes don't match messages")
}
m.mu.Lock()
defer m.mu.Unlock()
for _, identifier := range identifiers {
m.identifierHashes[string(identifier)] = envelopeHashes
}