Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions cmd/chain-receipts/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ func listener(provider *ethrpc.Provider, monitorOptions ethmonitor.Options, rece
)

var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
for {
select {
case receipt := <-sub.TransactionReceipt():
Expand Down Expand Up @@ -187,7 +185,7 @@ func listener(provider *ethrpc.Provider, monitorOptions ethmonitor.Options, rece
return
}
}
}()
})

wg.Wait()

Expand Down
6 changes: 2 additions & 4 deletions cmd/chain-watch/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ func chainWatch(provider *ethrpc.Provider, monitorOptions ethmonitor.Options) (*
count := 0

var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
for {
select {
case blocks := <-sub.Blocks():
Expand Down Expand Up @@ -210,7 +208,7 @@ func chainWatch(provider *ethrpc.Provider, monitorOptions ethmonitor.Options) (*
return
}
}
}()
})

// TODO: we can implement a program, chain-watch-test
// which will assert ethmonitor behaviour
Expand Down
6 changes: 2 additions & 4 deletions ethreceipts/ethreceipts.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,7 @@ func (l *ReceiptsListener) FetchTransactionReceiptWithFilter(ctx context.Context
// TODO/NOTE: perhaps in an extended node failure. could there be a scenario
// where filterer.Exhausted is never hit? and this subscription never unsubscribes..?
// don't think so, but we can double check.
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
defer sub.Unsubscribe()
defer close(mined)
defer close(finalized)
Expand Down Expand Up @@ -433,7 +431,7 @@ func (l *ReceiptsListener) FetchTransactionReceiptWithFilter(ctx context.Context
}
}
}
}()
})

// Wait for the first mined receipt or an exit signal
select {
Expand Down
6 changes: 2 additions & 4 deletions ethreceipts/ethreceipts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,15 +742,13 @@ func TestFiltersAddDeadlock(t *testing.T) {

// Now try to access the subscriber's filters from another goroutine
// This should deadlock if AddFilter is stuck holding the lock
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
time.Sleep(100 * time.Millisecond)

// This will try to acquire s.mu.Lock()
filters := sub.Filters()
t.Logf("Got %d filters", len(filters))
}()
})

done := make(chan struct{})
go func() {
Expand Down
Loading