File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -620,6 +620,11 @@ Network CNode::ConnectedThroughNetwork() const
620
620
return m_inbound_onion ? NET_ONION : addr.GetNetClass ();
621
621
}
622
622
623
+ bool CNode::IsConnectedThroughPrivacyNet () const
624
+ {
625
+ return m_inbound_onion || addr.IsPrivacyNet ();
626
+ }
627
+
623
628
#undef X
624
629
#define X (name ) stats.name = name
625
630
void CNode::CopyStats (CNodeStats& stats)
Original file line number Diff line number Diff line change @@ -506,6 +506,9 @@ class CNode
506
506
*/
507
507
Network ConnectedThroughNetwork () const ;
508
508
509
+ /* * Whether this peer connected through a privacy network. */
510
+ [[nodiscard]] bool IsConnectedThroughPrivacyNet () const ;
511
+
509
512
// We selected peer as (compact blocks) high-bandwidth peer (BIP152)
510
513
std::atomic<bool > m_bip152_highbandwidth_to{false };
511
514
// Peer selected us as (compact blocks) high-bandwidth peer (BIP152)
Original file line number Diff line number Diff line change @@ -188,6 +188,13 @@ class CNetAddr
188
188
bool IsInternal () const ;
189
189
bool IsValid () const ;
190
190
191
+ /* *
192
+ * Whether this object is a privacy network.
193
+ * TODO: consider adding IsCJDNS() here when more peers adopt CJDNS, see:
194
+ * https://github.com/bitcoin/bitcoin/pull/27411#issuecomment-1497176155
195
+ */
196
+ [[nodiscard]] bool IsPrivacyNet () const { return IsTor () || IsI2P (); }
197
+
191
198
/* *
192
199
* Check if the current object can be serialized in pre-ADDRv2/BIP155 format.
193
200
*/
You can’t perform that action at this time.
0 commit comments