From 10a198220350b6e767346afc0157a57ef1816dcd Mon Sep 17 00:00:00 2001 From: cui Date: Thu, 28 May 2026 16:05:40 +0800 Subject: [PATCH] eth/protocols/eth: fix track-before-send (#35056) Track the transaction only after it was sent out --- eth/protocols/eth/peer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index 2d7079fa12..9e1daae608 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -159,11 +159,13 @@ func (p *Peer) MarkTransaction(hash common.Hash) { // The reasons this is public is to allow packages using this protocol to write // tests that directly send messages without having to do the async queueing. func (p *Peer) SendTransactions(txs types.Transactions) error { - // Mark all the transactions as known, but ensure we don't overflow our limits + if err := p2p.Send(p.rw, TransactionsMsg, txs); err != nil { + return err + } for _, tx := range txs { p.knownTxs.Add(tx.Hash()) } - return p2p.Send(p.rw, TransactionsMsg, txs) + return nil } // AsyncSendTransactions queues a list of transactions (by hash) to eventually