eth/filters: prevent concurrent access in test (#30401)

use a mutex to prevent concurrent access to the api.filters map during `TestPendingTxFilterDeadlock` test
This commit is contained in:
Darioush Jalali 2024-09-13 02:16:47 -07:00 committed by GitHub
parent a01e9742d9
commit 7c6b3f9f14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -601,7 +601,9 @@ func TestPendingTxFilterDeadlock(t *testing.T) {
subs := make([]*Subscription, 20) subs := make([]*Subscription, 20)
for i := 0; i < len(subs); i++ { for i := 0; i < len(subs); i++ {
fid := api.NewPendingTransactionFilter(nil) fid := api.NewPendingTransactionFilter(nil)
api.filtersMu.Lock()
f, ok := api.filters[fid] f, ok := api.filters[fid]
api.filtersMu.Unlock()
if !ok { if !ok {
t.Fatalf("Filter %s should exist", fid) t.Fatalf("Filter %s should exist", fid)
} }