Skip to content

Commit f95b50a

Browse files
committed
refactor: privatise RelayInvFiltered and AskPeersForTransaction
With their usage being brokered by `MessageProcessingResult`, we can remove them from the interface and keep them as implementation details.
1 parent c93ade5 commit f95b50a

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

src/net_processing.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,6 @@ class PeerManagerImpl final : public PeerManager
629629
void PushInventory(NodeId nodeid, const CInv& inv) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
630630
void RelayInv(const CInv& inv) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
631631
void RelayInv(const CInv& inv, const int minProtoVersion) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
632-
void RelayInvFiltered(const CInv& inv, const CTransaction& relatedTx, const int minProtoVersion) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
633-
void RelayInvFiltered(const CInv& inv, const uint256& relatedTxHash, const int minProtoVersion) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
634632
void RelayTransaction(const uint256& txid) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
635633
void RelayRecoveredSig(const uint256& sigHash) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
636634
void RelayDSQ(const CCoinJoinQueue& queue) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
@@ -645,10 +643,21 @@ class PeerManagerImpl final : public PeerManager
645643
void RequestObject(NodeId nodeid, const CInv& inv, std::chrono::microseconds current_time,
646644
bool fForce = false) override EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
647645
size_t GetRequestedObjectCount(NodeId nodeid) const override EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
648-
void AskPeersForTransaction(const uint256& txid) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
649646
private:
650647
void _RelayTransaction(const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
651648

649+
/** Ask peers that have a transaction in their inventory to relay it to us. */
650+
void AskPeersForTransaction(const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
651+
652+
/** Relay inventories to peers that find it relevant */
653+
void RelayInvFiltered(const CInv& inv, const CTransaction& relatedTx, const int minProtoVersion) EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
654+
655+
/**
656+
* This overload will not update node filters, use it only for the cases
657+
* when other messages will update related transaction data in filters
658+
*/
659+
void RelayInvFiltered(const CInv& inv, const uint256& relatedTxHash, const int minProtoVersion) EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
660+
652661
/** Helper to process result of external handlers of message */
653662
void PostProcessMessage(MessageProcessingResult&& ret, NodeId node) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
654663

src/net_processing.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ class PeerManager : public CValidationInterface, public NetEventsInterface
8585
/** Send ping message to all peers */
8686
virtual void SendPings() = 0;
8787

88-
/** Ask a number of our peers, which have a transaction in their inventory, for the transaction. */
89-
virtual void AskPeersForTransaction(const uint256& txid) = 0;
90-
9188
/** Broadcast inventory message to a specific peer. */
9289
virtual void PushInventory(NodeId nodeid, const CInv& inv) = 0;
9390

@@ -97,15 +94,6 @@ class PeerManager : public CValidationInterface, public NetEventsInterface
9794
/** Relay inventories to all peers */
9895
virtual void RelayInv(const CInv& inv) = 0;
9996
virtual void RelayInv(const CInv& inv, const int minProtoVersion) = 0;
100-
virtual void RelayInvFiltered(const CInv& inv, const CTransaction& relatedTx,
101-
const int minProtoVersion = MIN_PEER_PROTO_VERSION) = 0;
102-
103-
/**
104-
* This overload will not update node filters, use it only for the cases
105-
* when other messages will update related transaction data in filters
106-
*/
107-
virtual void RelayInvFiltered(const CInv& inv, const uint256& relatedTxHash,
108-
const int minProtoVersion = MIN_PEER_PROTO_VERSION) = 0;
10997

11098
/** Relay transaction to all peers. */
11199
virtual void RelayTransaction(const uint256& txid) = 0;

0 commit comments

Comments
 (0)