aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2024-05-20 23:34:08 -0500
committerluigi1111 <luigi1111w@gmail.com>2024-05-20 23:34:08 -0500
commit5930557a94bd85d3494176da7e0d354cfa2654e6 (patch)
treec7899cf3a64608bc2bde7091416145ee1f11205f /src
parentb85f32073853f8009970e1b80bb3fa357b18c6d8 (diff)
parent7686af7acfa257b4e0df85e3c57f5bf821fd3f88 (diff)
downloadmonzero-core-5930557a94bd85d3494176da7e0d354cfa2654e6.tar.gz
monzero-core-5930557a94bd85d3494176da7e0d354cfa2654e6.tar.xz
monzero-core-5930557a94bd85d3494176da7e0d354cfa2654e6.zip
Merge pull request #9267
7686af7 Skip privacy networks (on tx sends) that don't have outgoing connections (Lee *!* Clagett)
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_protocol/levin_notify.cpp9
-rw-r--r--src/cryptonote_protocol/levin_notify.h3
-rw-r--r--src/p2p/net_node.inl5
3 files changed, 12 insertions, 5 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.
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 30e3d31b9..60d9392fd 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -2300,11 +2300,12 @@ namespace nodetool
if (enet::zone::tor < network->first)
break; // unknown network
- if (network->second.m_connect)
+ const auto status = network->second.m_notifier.get_status();
+ if (network->second.m_connect && status.has_outgoing)
return send(*network);
}
- // configuration should not allow this scenario
+ MWARNING("Unable to send " << txs.size() << " transaction(s): anonymity networks had no outgoing connections");
return enet::zone::invalid;
}
//-----------------------------------------------------------------------------------