Skip to content

Commit 1e18146

Browse files
committed
merge bitcoin#27270: Avoid CNode::m_relays_txs usage
1 parent c0ad23d commit 1e18146

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/net_processing.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3672,11 +3672,13 @@ void PeerManagerImpl::ProcessMessage(
36723672
if (greatest_common_version >= INCREASE_MAX_HEADERS2_VERSION && m_txreconciliation) {
36733673
// Per BIP-330, we announce txreconciliation support if:
36743674
// - protocol version per the peer's VERSION message supports INCREASE_MAX_HEADERS2_VERSION;
3675-
// - transaction relay is supported per the peer's VERSION message (see m_relays_txs);
3676-
// - this is not a block-relay-only connection and not a feeler (see m_relays_txs);
3675+
// - transaction relay is supported per the peer's VERSION message
3676+
// - this is not a block-relay-only connection and not a feeler
36773677
// - this is not an addr fetch connection;
36783678
// - we are not in -blocksonly mode.
3679-
if (pfrom.m_relays_txs && !pfrom.IsAddrFetchConn() && !m_ignore_incoming_txs) {
3679+
const auto* tx_relay = peer->GetTxRelay();
3680+
if (tx_relay && WITH_LOCK(tx_relay->m_bloom_filter_mutex, return tx_relay->m_relay_txs) &&
3681+
!pfrom.IsAddrFetchConn() && !m_ignore_incoming_txs) {
36803682
const uint64_t recon_salt = m_txreconciliation->PreRegisterPeer(pfrom.GetId());
36813683
m_connman.PushMessage(&pfrom, msg_maker.Make(NetMsgType::SENDTXRCNCL,
36823684
TXRECONCILIATION_VERSION, recon_salt));
@@ -3895,7 +3897,8 @@ void PeerManagerImpl::ProcessMessage(
38953897
// Peer must not offer us reconciliations if they specified no tx relay support in VERSION.
38963898
// This flag might also be false in other cases, but the RejectIncomingTxs check above
38973899
// eliminates them, so that this flag fully represents what we are looking for.
3898-
if (!pfrom.m_relays_txs) {
3900+
const auto* tx_relay = peer->GetTxRelay();
3901+
if (!tx_relay || !WITH_LOCK(tx_relay->m_bloom_filter_mutex, return tx_relay->m_relay_txs)) {
38993902
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "sendtxrcncl received from peer=%d which indicated no tx relay to us; disconnecting\n", pfrom.GetId());
39003903
pfrom.fDisconnect = true;
39013904
return;

0 commit comments

Comments
 (0)