HomePhabricator

[net processing] Don't initialize TxRelay for non-tx-relay peers.

Description

[net processing] Don't initialize TxRelay for non-tx-relay peers.

Summary:

[net processing] Add m_tx_relay_mutex to protect m_tx_relay ptr

[net processing] Don't initialize TxRelay for non-tx-relay peers.

Delay initializing the TxRelay data structure for a peer until we receive
a version message from that peer. At that point we'll know whether it
will ever relay transactions. We only initialize the m_tx_relay
data structure if:

  • this isn't an outbound block-relay-only connection; AND
  • fRelay=true OR we're offering NODE_BLOOM to this peer (NODE_BLOOM means that the peer may turn on tx relay later)

This concludes backport of core#22778
https://github.com/bitcoin/bitcoin/pull/22778/commits/b0a4ac9c26f60fd4993d89f45cafffaa389db2d4
https://github.com/bitcoin/bitcoin/pull/22778/commits/9db82f1bca0bb51c2180ca4a4ad63ba490e79da4

Depends on D14739

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
John Newbery <john@johnnewbery.com>Authored on Aug 27 2021, 08:28
PiRKCommitted on Nov 6 2023, 15:33
PiRKPushed on Nov 6 2023, 15:34
Reviewer
Restricted Project
Differential Revision
D14740: [net processing] Don't initialize TxRelay for non-tx-relay peers.
Parents
rABCcad451f1bf30: [net processing] Comment all TxRelay members
Branches
Unknown
Tags
Unknown