mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Add CNetAddr::IsPrivacyNet() and CNode::IsConnectedThroughPrivacyNet()
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
This commit is contained in:
@@ -620,6 +620,11 @@ Network CNode::ConnectedThroughNetwork() const
|
||||
return m_inbound_onion ? NET_ONION : addr.GetNetClass();
|
||||
}
|
||||
|
||||
bool CNode::IsConnectedThroughPrivacyNet() const
|
||||
{
|
||||
return m_inbound_onion || addr.IsPrivacyNet();
|
||||
}
|
||||
|
||||
#undef X
|
||||
#define X(name) stats.name = name
|
||||
void CNode::CopyStats(CNodeStats& stats)
|
||||
|
||||
@@ -506,6 +506,9 @@ public:
|
||||
*/
|
||||
Network ConnectedThroughNetwork() const;
|
||||
|
||||
/** Whether this peer connected through a privacy network. */
|
||||
[[nodiscard]] bool IsConnectedThroughPrivacyNet() const;
|
||||
|
||||
// We selected peer as (compact blocks) high-bandwidth peer (BIP152)
|
||||
std::atomic<bool> m_bip152_highbandwidth_to{false};
|
||||
// Peer selected us as (compact blocks) high-bandwidth peer (BIP152)
|
||||
|
||||
@@ -188,6 +188,13 @@ public:
|
||||
bool IsInternal() const;
|
||||
bool IsValid() const;
|
||||
|
||||
/**
|
||||
* Whether this object is a privacy network.
|
||||
* TODO: consider adding IsCJDNS() here when more peers adopt CJDNS, see:
|
||||
* https://github.com/bitcoin/bitcoin/pull/27411#issuecomment-1497176155
|
||||
*/
|
||||
[[nodiscard]] bool IsPrivacyNet() const { return IsTor() || IsI2P(); }
|
||||
|
||||
/**
|
||||
* Check if the current object can be serialized in pre-ADDRv2/BIP155 format.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user