From 5016e544066681ac22f099e31fbe0a45d9ce48e3 Mon Sep 17 00:00:00 2001 From: cui Date: Mon, 1 Jun 2026 10:56:23 +0800 Subject: [PATCH] eth/protocols/eth: only track after send is okay (#35086) --- eth/protocols/eth/peer.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index 9e1daae608..0dfd2e41c6 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -209,14 +209,15 @@ func (p *Peer) AsyncSendPooledTransactionHashes(hashes []common.Hash) { // ReplyPooledTransactionsRLP is the response to RequestTxs. func (p *Peer) ReplyPooledTransactionsRLP(id uint64, hashes []common.Hash, txs []rlp.RawValue) error { - // Mark all the transactions as known, but ensure we don't overflow our limits - p.knownTxs.Add(hashes...) - // Not packed into PooledTransactionsResponse to avoid RLP decoding - return p2p.Send(p.rw, PooledTransactionsMsg, &PooledTransactionsRLPPacket{ + if err := p2p.Send(p.rw, PooledTransactionsMsg, &PooledTransactionsRLPPacket{ RequestId: id, PooledTransactionsRLPResponse: txs, - }) + }); err != nil { + return err + } + p.knownTxs.Add(hashes...) + return nil } // ReplyBlockHeadersRLP is the response to GetBlockHeaders.