aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-01-02 09:53:53 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-01-02 09:54:01 +0100
commitae8f79713543d3db24a886cc27340b1570c2657d (patch)
treefdeaa608bb1a0141c9afc4e95a5b30ba8cc1f7d1 /src/net.h
parente75f91eae3936269b40b4bfdfe540d5526270936 (diff)
parent86c495223f048e5ca2cf0d8730af7db3b76f7aba (diff)
downloadbitcoin-ae8f79713543d3db24a886cc27340b1570c2657d.tar.xz
Merge #20210: net: assert CNode::m_inbound_onion is inbound in ctor, add getter, unit tests
86c495223f048e5ca2cf0d8730af7db3b76f7aba net: add CNode::IsInboundOnion() public getter and unit tests (Jon Atack) 6609eb8cb50fe92c7317b5db9e72d4333b3aab1b net: assert CNode::m_inbound_onion is inbound in ctor (Jon Atack) 993d1ecd191a7d9161082d4026f020cbf00835bb test, fuzz: fix constructing CNode with invalid inbound_onion (Jon Atack) Pull request description: The goal of this PR is to be able to depend on `m_inbound_onion` in AttemptToEvictConnection in #20197: - asserts `CNode::m_inbound_onion` is inbound in the CNode ctor to have a validity check at the class boundary - fixes a unit test and a fuzz utility that were passing invalid inbound onion values to the CNode ctor - drops an unneeded check in `CNode::ConnectedThroughNetwork()` for its inbound status - adds a public getter `IsInboundOnion()` that also allows unit testing it - adds unit test coverage ACKs for top commit: sipa: utACK 86c495223f048e5ca2cf0d8730af7db3b76f7aba LarryRuane: ACK 86c495223f048e5ca2cf0d8730af7db3b76f7aba vasild: ACK 86c495223f048e5ca2cf0d8730af7db3b76f7aba MarcoFalke: review ACK 86c495223f048e5ca2cf0d8730af7db3b76f7aba 🐍 Tree-SHA512: 21109105bc4e5e03076fadd489204be00eac710c9de0127708ca2d0a10a048ff81f640f589a7429967ac3eb51d35fe24bb2b12e53e7aa3efbc47aaff6396d204
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/net.h b/src/net.h
index 6316c73eee..a191ca8e03 100644
--- a/src/net.h
+++ b/src/net.h
@@ -1095,7 +1095,7 @@ private:
CService addrLocal GUARDED_BY(cs_addrLocal);
mutable RecursiveMutex cs_addrLocal;
- //! Whether this peer connected via our Tor onion service.
+ //! Whether this peer is an inbound onion, e.g. connected via our Tor onion service.
const bool m_inbound_onion{false};
public:
@@ -1219,6 +1219,9 @@ public:
void MaybeSetAddrName(const std::string& addrNameIn);
std::string ConnectionTypeAsString() const;
+
+ /** Whether this peer is an inbound onion, e.g. connected via our Tor onion service. */
+ bool IsInboundOnion() const { return m_inbound_onion; }
};
/** Return a timestamp in the future (in microseconds) for exponentially distributed events. */