mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 13:21:37 +00:00
cmd/devp2p/internal/ethtest: validate received txs, not the sent ones (#35170)
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 <bsbs8645@snu.ac.kr>
This commit is contained in:
parent
6e62cc5aa8
commit
cb387c9bc3
1 changed files with 5 additions and 1 deletions
|
|
@ -155,7 +155,11 @@ func (s *Suite) sendInvalidTxs(t *utesting.T, txs []*types.Transaction) error {
|
||||||
|
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case *eth.TransactionsPacket:
|
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 {
|
if _, ok := invalids[tx.Hash()]; ok {
|
||||||
return fmt.Errorf("received bad tx: %s", tx.Hash())
|
return fmt.Errorf("received bad tx: %s", tx.Hash())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue