[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