HomePhabricator

p2p: Ensure transaction announcements are only queued for fully connected peers

Description

p2p: Ensure transaction announcements are only queued for fully connected peers

Summary:

TxRelay::m_next_inv_send_time is initialized to 0, which means that any txids in TxRelay::m_tx_inventory_to_send will be announced on the first call to PeerManagerImpl::SendMessages for a fully connected peer (i.e. it completed the version handshake).

Prior to #21160, TxRelay::m_tx_inventory_to_send was guaranteed to be empty on the first SendMessages call, as transaction announcements were only queued for fully connected peers. #21160 replaced a CConnman::ForEachNode call with a loop over PeerManagerImpl::m_peer_map, in which the txid for a transaction to be relayed is added to TxRelay::m_tx_inventory_to_send for all peers. Even for those peers that have not completed the version handshake. Prior to the PR this was not the case as ForEachNode has a "fully connected check" before calling a function for each node.

This is a backport of core#26569

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D16798

Details

Provenance
dergoegge <n.goeggi@gmail.com>Authored on Nov 28 2022, 16:34
PiRKCommitted on Sep 23 2024, 08:18
PiRKPushed on Sep 23 2024, 08:18
Reviewer
Restricted Project
Differential Revision
D16798: p2p: Ensure transaction announcements are only queued for fully connected peers
Parents
rABCda9e51779f9e: net: Avoid SetTxRelay for feeler connections
Branches
Unknown
Tags
Unknown