@@ -1395,7 +1395,7 @@ void PeerManagerImpl::PushNodeVersion(CNode& pnode, const Peer& peer)
13951395 nProtocolVersion = gArgs .GetArg (" -pushversion" , PROTOCOL_VERSION);
13961396 }
13971397
1398- const bool tx_relay = !m_ignore_incoming_txs && !pnode. IsBlockOnlyConn () && !pnode.IsFeelerConn ();
1398+ const bool tx_relay = !m_ignore_incoming_txs && peer. m_can_tx_relay && !pnode.IsFeelerConn ();
13991399 m_connman.PushMessage (&pnode, CNetMsgMaker (INIT_PROTO_VERSION).Make (NetMsgType::VERSION, nProtocolVersion, my_services, nTime,
14001400 your_services, addr_you, // Together the pre-version-31402 serialization of CAddress "addrYou" (without nTime)
14011401 my_services, CService (), // Together the pre-version-31402 serialization of CAddress "addrMe" (without nTime)
@@ -2243,12 +2243,9 @@ void PeerManagerImpl::RelayInvFiltered(CInv &inv, const CTransaction& relatedTx,
22432243{
22442244 // TODO: Migrate to iteration through m_peer_map
22452245 m_connman.ForEachNode ([&](CNode* pnode) {
2246- if (pnode->nVersion < minProtoVersion || !pnode->CanRelay () || pnode->IsBlockOnlyConn ()) {
2247- return ;
2248- }
2249-
22502246 PeerRef peer = GetPeerRef (pnode->GetId ());
22512247 if (peer == nullptr ) return ;
2248+ if (pnode->nVersion < minProtoVersion || !pnode->CanRelay () || !peer->m_tx_relay ) return ;
22522249 {
22532250 LOCK (peer->m_tx_relay ->m_bloom_filter_mutex );
22542251 if (!peer->m_tx_relay ->m_relay_txs ) {
@@ -2266,12 +2263,9 @@ void PeerManagerImpl::RelayInvFiltered(CInv &inv, const uint256& relatedTxHash,
22662263{
22672264 // TODO: Migrate to iteration through m_peer_map
22682265 m_connman.ForEachNode ([&](CNode* pnode) {
2269- if (pnode->nVersion < minProtoVersion || !pnode->CanRelay () || pnode->IsBlockOnlyConn ()) {
2270- return ;
2271- }
2272-
22732266 PeerRef peer = GetPeerRef (pnode->GetId ());
22742267 if (peer == nullptr ) return ;
2268+ if (pnode->nVersion < minProtoVersion || !pnode->CanRelay () || !peer->m_tx_relay ) return ;
22752269 {
22762270 LOCK (peer->m_tx_relay ->m_bloom_filter_mutex );
22772271 if (!peer->m_tx_relay ->m_relay_txs ) {
@@ -2424,7 +2418,7 @@ void PeerManagerImpl::ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv&
24242418 } else if (inv.IsMsgFilteredBlk ()) {
24252419 bool sendMerkleBlock = false ;
24262420 CMerkleBlock merkleBlock;
2427- if (!pfrom. IsBlockOnlyConn () ) {
2421+ if (peer. m_can_tx_relay ) {
24282422 LOCK (peer.m_tx_relay ->m_bloom_filter_mutex );
24292423 if (peer.m_tx_relay ->m_bloom_filter ) {
24302424 sendMerkleBlock = true ;
@@ -2526,8 +2520,8 @@ void PeerManagerImpl::ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic
25262520
25272521 const std::chrono::seconds now = GetTime<std::chrono::seconds>();
25282522 // Get last mempool request time
2529- const std::chrono::seconds mempool_req = !pfrom. IsBlockOnlyConn () ? peer.m_tx_relay ->m_last_mempool_req .load ()
2530- : std::chrono::seconds::min ();
2523+ const std::chrono::seconds mempool_req = peer. m_can_tx_relay ? peer.m_tx_relay ->m_last_mempool_req .load ()
2524+ : std::chrono::seconds::min ();
25312525
25322526 // Process as many TX items from the front of the getdata queue as
25332527 // possible, since they're common and it's efficient to batch process
@@ -3486,7 +3480,7 @@ void PeerManagerImpl::ProcessMessage(
34863480 }
34873481 peer->m_starting_height = starting_height;
34883482
3489- if (!pfrom. IsBlockOnlyConn () ) {
3483+ if (peer-> m_can_tx_relay ) {
34903484 {
34913485 LOCK (peer->m_tx_relay ->m_bloom_filter_mutex );
34923486 peer->m_tx_relay ->m_relay_txs = fRelay ; // set to true after we get the first filter* message
@@ -4750,7 +4744,7 @@ void PeerManagerImpl::ProcessMessage(
47504744 return ;
47514745 }
47524746
4753- if (!pfrom. IsBlockOnlyConn () ) {
4747+ if (peer-> m_can_tx_relay ) {
47544748 LOCK (peer->m_tx_relay ->m_tx_inventory_mutex );
47554749 peer->m_tx_relay ->m_send_mempool = true ;
47564750 }
@@ -4844,7 +4838,7 @@ void PeerManagerImpl::ProcessMessage(
48444838 // There is no excuse for sending a too-large filter
48454839 Misbehaving (pfrom.GetId (), 100 , " too-large bloom filter" );
48464840 }
4847- else if (!pfrom. IsBlockOnlyConn () )
4841+ else if (peer-> m_can_tx_relay )
48484842 {
48494843 {
48504844 LOCK (peer->m_tx_relay ->m_bloom_filter_mutex );
@@ -4871,7 +4865,7 @@ void PeerManagerImpl::ProcessMessage(
48714865 bool bad = false ;
48724866 if (vData.size () > MAX_SCRIPT_ELEMENT_SIZE) {
48734867 bad = true ;
4874- } else if (!pfrom. IsBlockOnlyConn () ) {
4868+ } else if (peer-> m_can_tx_relay ) {
48754869 LOCK (peer->m_tx_relay ->m_bloom_filter_mutex );
48764870 if (peer->m_tx_relay ->m_bloom_filter ) {
48774871 peer->m_tx_relay ->m_bloom_filter ->insert (vData);
@@ -4891,7 +4885,7 @@ void PeerManagerImpl::ProcessMessage(
48914885 pfrom.fDisconnect = true ;
48924886 return ;
48934887 }
4894- if (pfrom. IsBlockOnlyConn () ) {
4888+ if (!peer-> m_can_tx_relay ) {
48954889 return ;
48964890 }
48974891
@@ -5759,7 +5753,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
57595753 LOCK (peer->m_block_inv_mutex );
57605754
57615755 size_t reserve = INVENTORY_BROADCAST_MAX_PER_1MB_BLOCK * MaxBlockSize () / 1000000 ;
5762- if (!pto-> IsBlockOnlyConn () ) {
5756+ if (peer-> m_can_tx_relay ) {
57635757 LOCK (peer->m_tx_relay ->m_tx_inventory_mutex );
57645758 reserve = std::min<size_t >(peer->m_tx_relay ->m_tx_inventory_to_send .size (), reserve);
57655759 }
@@ -5791,7 +5785,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
57915785 }
57925786 };
57935787
5794- if (!pto-> IsBlockOnlyConn () ) {
5788+ if (peer-> m_can_tx_relay ) {
57955789 LOCK (peer->m_tx_relay ->m_tx_inventory_mutex );
57965790 // Check whether periodic sends should happen
57975791 // Note: If this node is running in a Masternode mode, it makes no sense to delay outgoing txes
0 commit comments