Skip to content

Commit

Permalink
cmd/devp2p/internal/ethtest: ignore block announcement in tx test (et…
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl authored May 27, 2021
1 parent 04cb5e2 commit ee35ddc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/devp2p/internal/ethtest/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand All @@ -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))
Expand Down

0 comments on commit ee35ddc

Please sign in to comment.