mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-11-10 18:25:17 +00:00
fix: mutex locking around entire dependencyMap logic
This commit is contained in:
parent
6b660d0da7
commit
645afad9c6
@ -439,8 +439,9 @@ func (e *CeremonyDataClockConsensusEngine) handleProvingKey(
|
|||||||
zap.Binary("proving_key", provingKey),
|
zap.Binary("proving_key", provingKey),
|
||||||
)
|
)
|
||||||
|
|
||||||
if e.dependencyMap[string(provingKey)] != nil {
|
go func() {
|
||||||
go func() {
|
e.dependencyMapMx.Lock()
|
||||||
|
if e.dependencyMap[string(provingKey)] != nil {
|
||||||
keyBundleAnnouncement := &protobufs.KeyBundleAnnouncement{}
|
keyBundleAnnouncement := &protobufs.KeyBundleAnnouncement{}
|
||||||
if err := proto.Unmarshal(
|
if err := proto.Unmarshal(
|
||||||
e.dependencyMap[string(provingKey)].Value,
|
e.dependencyMap[string(provingKey)].Value,
|
||||||
@ -450,6 +451,7 @@ func (e *CeremonyDataClockConsensusEngine) handleProvingKey(
|
|||||||
"could not unmarshal key bundle announcement",
|
"could not unmarshal key bundle announcement",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
)
|
)
|
||||||
|
e.dependencyMapMx.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := keyBundleAnnouncement.Verify(
|
if err := keyBundleAnnouncement.Verify(
|
||||||
@ -459,16 +461,16 @@ func (e *CeremonyDataClockConsensusEngine) handleProvingKey(
|
|||||||
"could not verify key bundle announcement",
|
"could not verify key bundle announcement",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
)
|
)
|
||||||
|
e.dependencyMapMx.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
e.pendingCommits <- e.dependencyMap[string(provingKey)]
|
e.pendingCommits <- e.dependencyMap[string(provingKey)]
|
||||||
|
|
||||||
e.dependencyMapMx.Lock()
|
|
||||||
delete(e.dependencyMap, string(provingKey))
|
delete(e.dependencyMap, string(provingKey))
|
||||||
e.dependencyMapMx.Unlock()
|
}
|
||||||
}()
|
e.dependencyMapMx.Unlock()
|
||||||
}
|
}()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user