diff options
author | Lee Clagett <code@leeclagett.com> | 2020-03-07 18:13:18 -0500 |
---|---|---|
committer | Lee Clagett <code@leeclagett.com> | 2020-03-07 00:03:17 +0000 |
commit | ebf3c10fcb1bb0d38fe7d60f101210443d08f253 (patch) | |
tree | 5710f08c501ad08c16c4d56cb46187e7dd09959d /src/cryptonote_protocol/levin_notify.cpp | |
parent | Merge pull request #6248 (diff) | |
download | monero-ebf3c10fcb1bb0d38fe7d60f101210443d08f253.tar.xz |
Added logging for dropped local txes with no i2p/tor connections
Diffstat (limited to 'src/cryptonote_protocol/levin_notify.cpp')
-rw-r--r-- | src/cryptonote_protocol/levin_notify.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/cryptonote_protocol/levin_notify.cpp b/src/cryptonote_protocol/levin_notify.cpp index e45c34e02..bba0a27ce 100644 --- a/src/cryptonote_protocol/levin_notify.cpp +++ b/src/cryptonote_protocol/levin_notify.cpp @@ -44,6 +44,9 @@ #include "net/dandelionpp.h" #include "p2p/net_node.h" +#undef MONERO_DEFAULT_LOG_CATEGORY +#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p.tx" + namespace { int get_command_from_message(const cryptonote::blobdata &msg) @@ -298,6 +301,8 @@ namespace levin if (!channel.connection.is_nil()) channel.queue.push_back(std::move(message_)); + else if (destination_ == 0 && zone_->connection_count == 0) + MWARNING("Unable to send transaction(s) over anonymity network - no available outbound connections"); } }; @@ -390,10 +395,12 @@ namespace levin random_poisson in_duration(fluff_average_in); random_poisson out_duration(fluff_average_out); - zone_->p2p->foreach_connection([this, now, &in_duration, &out_duration, &next_flush] (detail::p2p_context& context) + bool available = false; + zone_->p2p->foreach_connection([this, now, &in_duration, &out_duration, &next_flush, &available] (detail::p2p_context& context) { if (this->source_ != context.m_connection_id && (this->zone_->is_public || !context.m_is_income)) { + available = true; if (context.fluff_txs.empty()) context.flush_time = now + (context.m_is_income ? in_duration() : out_duration()); @@ -405,6 +412,9 @@ namespace levin return true; }); + if (!available) + MWARNING("Unable to send transaction(s), no available connections"); + if (next_flush < zone_->flush_time) fluff_flush::queue(std::move(zone_), next_flush); } @@ -564,9 +574,12 @@ namespace levin { channel.active = nullptr; channel.connection = boost::uuids::nil_uuid(); - zone_->strand.post( - update_channels{zone_, get_out_connections(*zone_->p2p)} - ); + + auto connections = get_out_connections(*zone_->p2p); + if (connections.empty()) + MWARNING("Lost all outbound connections to anonymity network - currently unable to send transaction(s)"); + + zone_->strand.post(update_channels{zone_, std::move(connections)}); } } |