Skip to content

Commit 17ec003

Browse files
committed
Merge pull request #6376
6177e49 Added logging for dropped local txes with no i2p/tor connections (vtnerd)
2 parents 7ca6b55 + 6177e49 commit 17ec003

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/cryptonote_protocol/levin_notify.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
#include "net/dandelionpp.h"
4444
#include "p2p/net_node.h"
4545

46+
#undef MONERO_DEFAULT_LOG_CATEGORY
47+
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p.tx"
48+
4649
namespace cryptonote
4750
{
4851
namespace levin
@@ -242,6 +245,8 @@ namespace levin
242245

243246
if (!channel.connection.is_nil())
244247
channel.queue.push_back(std::move(message_));
248+
else if (destination_ == 0 && zone_->connection_count == 0)
249+
MWARNING("Unable to send transaction(s) over anonymity network - no available outbound connections");
245250
}
246251
};
247252

@@ -286,8 +291,12 @@ namespace levin
286291
return true;
287292
});
288293

294+
bool sent = false;
289295
for (const boost::uuids::uuid& connection : connections)
290-
zone_->p2p->send(message_.clone(), connection);
296+
sent |= zone_->p2p->send(message_.clone(), connection);
297+
298+
if (!sent)
299+
MWARNING("Unable to send transaction(s), no available connections");
291300
}
292301
};
293302

@@ -441,9 +450,12 @@ namespace levin
441450
{
442451
channel.active = nullptr;
443452
channel.connection = boost::uuids::nil_uuid();
444-
zone_->strand.post(
445-
update_channels{zone_, get_out_connections(*zone_->p2p)}
446-
);
453+
454+
auto connections = get_out_connections(*zone_->p2p);
455+
if (connections.empty())
456+
MWARNING("Lost all outbound connections to anonymity network - currently unable to send transaction(s)");
457+
458+
zone_->strand.post(update_channels{zone_, std::move(connections)});
447459
}
448460
}
449461

0 commit comments

Comments
 (0)