Skip to content

Commit 047880c

Browse files
Change the aggregatedSlotCommitteeIDCacheLock to release the lock immediately after r/w (#6437)
* Change the aggregatedSlotCommitteeIDCacheLock to release the lock immediately after r/w * Merge branch 'master' into better-validator-lock * Merge branch 'master' into better-validator-lock
1 parent 2bce9c8 commit 047880c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

validator/client/polling/aggregate.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ func (v *validator) SubmitAggregateAndProof(ctx context.Context, slot uint64, pu
3838
// Avoid sending beacon node duplicated aggregation requests.
3939
k := validatorSubscribeKey(slot, duty.CommitteeIndex)
4040
v.aggregatedSlotCommitteeIDCacheLock.Lock()
41-
defer v.aggregatedSlotCommitteeIDCacheLock.Unlock()
4241
if v.aggregatedSlotCommitteeIDCache.Contains(k) {
42+
v.aggregatedSlotCommitteeIDCacheLock.Unlock()
4343
return
4444
}
4545
v.aggregatedSlotCommitteeIDCache.Add(k, true)
46+
v.aggregatedSlotCommitteeIDCacheLock.Unlock()
4647

4748
slotSig, err := v.signSlot(ctx, pubKey, slot)
4849
if err != nil {

0 commit comments

Comments
 (0)