mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 12:16:44 +00:00
eth/protocols/eth: track announced tx hashes only after send (#35384)
Commit1f87331fbmoved 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 <bsbs8645@snu.ac.kr>
This commit is contained in:
parent
4363b81e6f
commit
a38a90bc60
1 changed files with 10 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue