eth/fetcher: avoid hang in tests (partial fix for #23331) (#23351)

* eth/fetcher: fix test to avoid hanging. Partial fix for #23331

* eth/filters: avoid dangling goroutines

* eth/fetcher: revert closing of proceed
This commit is contained in:
Martin Holst Swende authored and GitHub committed 2022-05-06 15:23:43 +02:00
1 parent 3b967d16ca
commit 7175f82495
2 files changed
+17 -5

No files matched your search

+10 -1
View File
@@ -304,7 +304,6 @@ func TestTransactionFetcherSingletonRequesting(t *testing.T) {
func TestTransactionFetcherFailedRescheduling(t *testing.T) {
// Create a channel to control when tx requests can fail
proceed := make(chan struct{})
testTransactionFetcherParallel(t, txFetcherTest{
init: func() *TxFetcher {
return NewTxFetcher(
@@ -1263,6 +1262,16 @@ func testTransactionFetcher(t *testing.T, tt txFetcherTest) {
fetcher.Start()
defer fetcher.Stop()
defer func() { // drain the wait chan on exit
for {
select {
case <-wait:
default:
return
}
}
}()
// Crunch through all the test steps and execute them
for i, step := range tt.steps {
switch step := step.(type) {