mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 18:51:19 +00:00
Release lock before return validatedTips
(#10289)
* Release lock before return * add test Co-authored-by: Potuz <potuz@prysmaticlabs.com>
This commit is contained in:
parent
339540274b
commit
a9a75e0004
@ -47,6 +47,7 @@ func (f *ForkChoice) Optimistic(ctx context.Context, root [32]byte, slot types.S
|
||||
f.syncedTips.RLock()
|
||||
_, ok := f.syncedTips.validatedTips[root]
|
||||
if ok {
|
||||
f.syncedTips.RUnlock()
|
||||
return false, nil
|
||||
}
|
||||
f.syncedTips.RUnlock()
|
||||
|
@ -200,6 +200,10 @@ func TestOptimistic(t *testing.T) {
|
||||
op, err = f.Optimistic(ctx, nodeK.root, nodeK.slot)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, op, true)
|
||||
|
||||
// request a write Lock to synced Tips regression #10289
|
||||
f.syncedTips.Lock()
|
||||
defer f.syncedTips.Unlock()
|
||||
}
|
||||
|
||||
// This tests the algorithm to update syncedTips
|
||||
|
Loading…
Reference in New Issue
Block a user