From cb387c9bc32dddad0530be795f80f0744be8a927 Mon Sep 17 00:00:00 2001 From: cui Date: Tue, 16 Jun 2026 21:31:02 +0800 Subject: [PATCH] cmd/devp2p/internal/ethtest: validate received txs, not the sent ones (#35170) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sendInvalidTxs's *eth.TransactionsPacket case iterated `txs` — the locally-sent invalid transactions, every one of which is in `invalids` by construction — instead of the transactions actually carried by the received packet. As a result the loop returned "received bad tx" on the very first TransactionsPacket the peer sent, regardless of its contents, and never inspected what was really propagated. Iterate msg.Items() (the decoded contents of the received packet) so the "node must not propagate invalid txs" conformance check tests the real condition instead of producing a false negative. --------- Co-authored-by: Bosul Mun --- cmd/devp2p/internal/ethtest/transaction.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/devp2p/internal/ethtest/transaction.go b/cmd/devp2p/internal/ethtest/transaction.go index 8ce26f3e1a..855e799b4f 100644 --- a/cmd/devp2p/internal/ethtest/transaction.go +++ b/cmd/devp2p/internal/ethtest/transaction.go @@ -155,7 +155,11 @@ func (s *Suite) sendInvalidTxs(t *utesting.T, txs []*types.Transaction) error { switch msg := msg.(type) { case *eth.TransactionsPacket: - for _, tx := range txs { + received, err := msg.Items() + if err != nil { + return fmt.Errorf("failed to decode received transactions: %w", err) + } + for _, tx := range received { if _, ok := invalids[tx.Hash()]; ok { return fmt.Errorf("received bad tx: %s", tx.Hash()) }