From ee35ddc8fdf5fe12f42cac3bd7a40d8fe7a384f2 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 27 May 2021 20:53:33 +0200 Subject: [PATCH] cmd/devp2p/internal/ethtest: ignore block announcement in tx test (#22957) --- cmd/devp2p/internal/ethtest/suite.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/devp2p/internal/ethtest/suite.go b/cmd/devp2p/internal/ethtest/suite.go index 491bcda7e..bbc955cd7 100644 --- a/cmd/devp2p/internal/ethtest/suite.go +++ b/cmd/devp2p/internal/ethtest/suite.go @@ -732,17 +732,20 @@ func (s *Suite) TestNewPooledTxs66(t *utesting.T) { if err := s.sendNextBlock(eth66); err != nil { t.Fatalf("failed to send next block: %v", err) } + // generate 50 txs hashMap, _, err := generateTxs(s, 50) if err != nil { t.Fatalf("failed to generate transactions: %v", err) } + // create new pooled tx hashes announcement hashes := make([]common.Hash, 0) for _, hash := range hashMap { hashes = append(hashes, hash) } announce := NewPooledTransactionHashes(hashes) + // send announcement conn, err := s.dial66() if err != nil { @@ -755,6 +758,7 @@ func (s *Suite) TestNewPooledTxs66(t *utesting.T) { if err = conn.Write(announce); err != nil { t.Fatalf("failed to write to connection: %v", err) } + // wait for GetPooledTxs request for { _, msg := conn.readAndServe66(s.chain, timeout) @@ -764,8 +768,13 @@ func (s *Suite) TestNewPooledTxs66(t *utesting.T) { t.Fatalf("unexpected number of txs requested: wanted %d, got %d", len(hashes), len(msg)) } return + // ignore propagated txs from previous tests case *NewPooledTransactionHashes: - // ignore propagated txs from old tests + continue + // ignore block announcements from previous tests + case *NewBlockHashes: + continue + case *NewBlock: continue default: t.Fatalf("unexpected %s", pretty.Sdump(msg))