aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol
diff options
context:
space:
mode:
authorLee *!* Clagett <code@leeclagett.com>2024-03-28 19:02:17 -0400
committerLee *!* Clagett <code@leeclagett.com>2024-03-29 15:30:14 -0400
commit7686af7acfa257b4e0df85e3c57f5bf821fd3f88 (patch)
treecd04110ec9a2073912abf951e87445fdaf934538 /src/cryptonote_protocol
parent81d4db08eb75ce5392c65ca6571e7b08e41b7c95 (diff)
downloadmonzero-core-7686af7acfa257b4e0df85e3c57f5bf821fd3f88.tar.gz
monzero-core-7686af7acfa257b4e0df85e3c57f5bf821fd3f88.tar.xz
monzero-core-7686af7acfa257b4e0df85e3c57f5bf821fd3f88.zip
Skip privacy networks (on tx sends) that don't have outgoing connections
Diffstat (limited to 'src/cryptonote_protocol')
-rw-r--r--src/cryptonote_protocol/levin_notify.cpp9
-rw-r--r--src/cryptonote_protocol/levin_notify.h3
2 files changed, 9 insertions, 3 deletions
diff --git a/src/cryptonote_protocol/levin_notify.cpp b/src/cryptonote_protocol/levin_notify.cpp
index 27c6d0278..92034a435 100644
--- a/src/cryptonote_protocol/levin_notify.cpp
+++ b/src/cryptonote_protocol/levin_notify.cpp
@@ -741,9 +741,14 @@ namespace levin
notify::status notify::get_status() const noexcept
{
if (!zone_)
- return {false, false};
+ return {false, false, false};
- return {!zone_->noise.empty(), CRYPTONOTE_NOISE_CHANNELS <= zone_->connection_count};
+ // `connection_count` is only set when `!noise.empty()`.
+ const std::size_t connection_count = zone_->connection_count;
+ bool has_outgoing = connection_count;
+ if (zone_->noise.empty())
+ has_outgoing = zone_->p2p->get_out_connections_count();
+ return {!zone_->noise.empty(), CRYPTONOTE_NOISE_CHANNELS <= connection_count, has_outgoing};
}
void notify::new_out_connection()
diff --git a/src/cryptonote_protocol/levin_notify.h b/src/cryptonote_protocol/levin_notify.h
index 2927eea86..9fc7ab892 100644
--- a/src/cryptonote_protocol/levin_notify.h
+++ b/src/cryptonote_protocol/levin_notify.h
@@ -75,7 +75,8 @@ namespace levin
struct status
{
bool has_noise;
- bool connections_filled;
+ bool connections_filled; //!< True when has zone has `CRYPTONOTE_NOISE_CHANNELS` outgoing noise channels
+ bool has_outgoing; //!< True when zone has outgoing connections
};
//! Construct an instance that cannot notify.