partial bitcoin#26396: Avoid SetTxRelay for feeler connections

excludes:
- fa24239a (changes to `p2p_sendtxrcncl.py`)
This commit is contained in:
Kittywhiskers Van Gogh 2022-10-26 18:17:01 +02:00
parent 221a78ea84
commit 6a37934af4
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 5 additions and 7 deletions

View File

@ -929,10 +929,8 @@ public:
/** Whether this peer provides all services that we want. Used for eviction decisions */ /** Whether this peer provides all services that we want. Used for eviction decisions */
std::atomic_bool m_has_all_wanted_services{false}; std::atomic_bool m_has_all_wanted_services{false};
/** Whether we should relay transactions to this peer (their version /** Whether we should relay transactions to this peer. This only changes
* message did not include fRelay=false and this is not a block-relay-only * from false to true. It will never change back to false. */
* connection). This only changes from false to true. It will never change
* back to false. Used only in inbound eviction logic. */
std::atomic_bool m_relays_txs{false}; std::atomic_bool m_relays_txs{false};
/** Whether this peer has loaded a bloom filter. Used only in inbound /** Whether this peer has loaded a bloom filter. Used only in inbound

View File

@ -399,9 +399,7 @@ private:
Mutex m_tx_relay_mutex; Mutex m_tx_relay_mutex;
/** Transaction relay data. /** Transaction relay data.
* (Bitcoin) Will be a nullptr if we're not relaying transactions with this peer * (Bitcoin) Transaction relay data. May be a nullptr.
* (e.g. if it's a block-relay-only peer). Users should access this with
* the GetTxRelay() getter.
* (Dash) Always initialized but selectively available through GetTxRelay() * (Dash) Always initialized but selectively available through GetTxRelay()
* (non-transaction relay should use GetInvRelay(), which will provide * (non-transaction relay should use GetInvRelay(), which will provide
* unconditional access) */ * unconditional access) */
@ -3523,9 +3521,11 @@ void PeerManagerImpl::ProcessMessage(
// We only initialize the m_tx_relay data structure if: // We only initialize the m_tx_relay data structure if:
// - this isn't an outbound block-relay-only connection; and // - this isn't an outbound block-relay-only connection; and
// - this isn't an outbound feeler connection, and
// - fRelay=true or we're offering NODE_BLOOM to this peer // - fRelay=true or we're offering NODE_BLOOM to this peer
// (NODE_BLOOM means that the peer may turn on tx relay later) // (NODE_BLOOM means that the peer may turn on tx relay later)
if (!pfrom.IsBlockOnlyConn() && if (!pfrom.IsBlockOnlyConn() &&
!pfrom.IsFeelerConn() &&
(fRelay || (peer->m_our_services & NODE_BLOOM))) { (fRelay || (peer->m_our_services & NODE_BLOOM))) {
auto* const tx_relay = peer->SetTxRelay(); auto* const tx_relay = peer->SetTxRelay();
{ {