mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Revert "eth/filters: fix flaky test TestPendingTxFilterDeadlock (#28376)"
This reverts commit 492977c671.
This commit is contained in:
parent
4e458239fb
commit
75890f77df
1 changed files with 17 additions and 13 deletions
|
|
@ -915,14 +915,10 @@ func TestPendingTxFilterDeadlock(t *testing.T) {
|
||||||
|
|
||||||
// Create a bunch of filters that will
|
// Create a bunch of filters that will
|
||||||
// timeout either in 100ms or 200ms
|
// timeout either in 100ms or 200ms
|
||||||
subs := make([]*Subscription, 20)
|
fids := make([]rpc.ID, 20)
|
||||||
for i := 0; i < len(subs); i++ {
|
for i := 0; i < len(fids); i++ {
|
||||||
fid := api.NewPendingTransactionFilter(nil)
|
fid := api.NewPendingTransactionFilter(nil)
|
||||||
f, ok := api.filters[fid]
|
fids[i] = fid
|
||||||
if !ok {
|
|
||||||
t.Fatalf("Filter %s should exist", fid)
|
|
||||||
}
|
|
||||||
subs[i] = f.s
|
|
||||||
// Wait for at least one tx to arrive in filter
|
// Wait for at least one tx to arrive in filter
|
||||||
for {
|
for {
|
||||||
hashes, err := api.GetFilterChanges(fid)
|
hashes, err := api.GetFilterChanges(fid)
|
||||||
|
|
@ -936,14 +932,22 @@ func TestPendingTxFilterDeadlock(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until filters have timed out and have been uninstalled.
|
// Wait until filters have timed out
|
||||||
for _, sub := range subs {
|
time.Sleep(3 * timeout)
|
||||||
|
|
||||||
|
// If tx loop doesn't consume `done` after a second
|
||||||
|
// it's hanging.
|
||||||
select {
|
select {
|
||||||
case <-sub.Err():
|
case done <- struct{}{}:
|
||||||
case <-time.After(1 * time.Second):
|
// Check that all filters have been uninstalled
|
||||||
t.Fatalf("Filter timeout is hanging")
|
for _, fid := range fids {
|
||||||
|
if _, err := api.GetFilterChanges(fid); err == nil {
|
||||||
|
t.Errorf("Filter %s should have been uninstalled\n", fid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case <-time.After(1 * time.Second):
|
||||||
|
t.Error("Tx sending loop hangs")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func flattenLogs(pl [][]*types.Log) []*types.Log {
|
func flattenLogs(pl [][]*types.Log) []*types.Log {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue