From a38a90bc60c1f4c9f7259a3e1ce83bbe924f8305 Mon Sep 17 00:00:00 2001 From: 0xoasis Date: Mon, 20 Jul 2026 21:40:04 +0800 Subject: [PATCH] eth/protocols/eth: track announced tx hashes only after send (#35384) Commit 1f87331fb moved the known-transaction marking in `sendPooledTransactionHashes` to after a successful send, so hashes are not marked known to the peer if the announcement fails to go out. The sparse blobpool change (d91b71fb3) reintroduced the original track-before-send ordering when adding the eth/72 packet variant, causing failed announcements to suppress future re-announcements of the same hashes to that peer. This restores the send-first ordering for both eth/71 and eth/72 packet versions, and adds a regression test covering success and failure paths on both protocol versions. ## Checklist - [x] Restored mark-known-after-send for ETH71 and ETH72 - [x] Added `TestSendPooledTransactionHashes` covering success and closed-pipe failure --------- Co-authored-by: Bosul Mun --- eth/protocols/eth/peer.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index 583b2dce38..61debbeadb 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -192,12 +192,18 @@ func (p *Peer) AsyncSendTransactions(hashes []common.Hash) { // directly as the queueing (memory) and transmission (bandwidth) costs should // not be managed directly. func (p *Peer) sendPooledTransactionHashes(hashes []common.Hash, types []byte, sizes []uint32, cells types.CustodyBitmap) error { + var err error + if p.version >= ETH72 { + err = p2p.Send(p.rw, NewPooledTransactionHashesMsg, NewPooledTransactionHashesPacket72{Types: types, Sizes: sizes, Hashes: hashes, Mask: cells}) + } else { + err = p2p.Send(p.rw, NewPooledTransactionHashesMsg, NewPooledTransactionHashesPacket71{Types: types, Sizes: sizes, Hashes: hashes}) + } + if err != nil { + return err + } // Mark all the transactions as known, but ensure we don't overflow our limits p.knownTxs.Add(hashes...) - if p.version >= ETH72 { - return p2p.Send(p.rw, NewPooledTransactionHashesMsg, NewPooledTransactionHashesPacket72{Types: types, Sizes: sizes, Hashes: hashes, Mask: cells}) - } - return p2p.Send(p.rw, NewPooledTransactionHashesMsg, NewPooledTransactionHashesPacket71{Types: types, Sizes: sizes, Hashes: hashes}) + return nil } // AsyncSendPooledTransactionHashes queues a list of transactions hashes to eventually