Merge commit '00ede00' into MergeUpstream3

This commit is contained in:
Doyle 2020-05-28 15:59:14 +10:00
commit 05a7d674bd
4 changed files with 25 additions and 17 deletions

View file

@ -128,7 +128,7 @@ namespace net_utils
// https://stackoverflow.com/questions/256405/programmatically-create-x509-certificate-using-openssl
bool create_rsa_ssl_certificate(EVP_PKEY *&pkey, X509 *&cert)
{
MGINFO("Generating SSL certificate");
MINFO("Generating SSL certificate");
pkey = EVP_PKEY_new();
if (!pkey)
{
@ -198,7 +198,7 @@ bool create_rsa_ssl_certificate(EVP_PKEY *&pkey, X509 *&cert)
bool create_ec_ssl_certificate(EVP_PKEY *&pkey, X509 *&cert, int type)
{
MGINFO("Generating SSL certificate");
MINFO("Generating SSL certificate");
pkey = EVP_PKEY_new();
if (!pkey)
{

View file

@ -43,6 +43,9 @@
#include "net/dandelionpp.h"
#include "p2p/net_node.h"
#undef LOKI_DEFAULT_LOG_CATEGORY
#define LOKI_DEFAULT_LOG_CATEGORY "net.p2p.tx"
namespace cryptonote
{
namespace levin
@ -242,6 +245,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");
}
};
@ -441,9 +446,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)});
}
}

View file

@ -1048,17 +1048,15 @@ namespace nodetool
pi = context.peer_id = rsp.node_data.peer_id;
context.m_rpc_port = rsp.node_data.rpc_port;
m_network_zones.at(context.m_remote_address.get_zone()).m_peerlist.set_peer_just_seen(rsp.node_data.peer_id, context.m_remote_address, context.m_pruning_seed, context.m_rpc_port);
network_zone& zone = m_network_zones.at(context.m_remote_address.get_zone());
zone.m_peerlist.set_peer_just_seen(rsp.node_data.peer_id, context.m_remote_address, context.m_pruning_seed, context.m_rpc_port);
// move
for (auto const& zone : m_network_zones)
if(rsp.node_data.peer_id == zone.m_config.m_peer_id)
{
if(rsp.node_data.peer_id == zone.second.m_config.m_peer_id)
{
LOG_DEBUG_CC(context, "Connection to self detected, dropping connection");
hsh_result = false;
return;
}
LOG_DEBUG_CC(context, "Connection to self detected, dropping connection");
hsh_result = false;
return;
}
LOG_INFO_CC(context, "New connection handshaked, pruning seed " << epee::string_tools::to_string_hex(context.m_pruning_seed));
LOG_DEBUG_CC(context, " COMMAND_HANDSHAKE INVOKED OK");

View file

@ -458,8 +458,8 @@ TEST_F(levin_notify, flood)
}
std::vector<cryptonote::blobdata> txs(2);
txs[0].resize(100, 'e');
txs[1].resize(200, 'f');
txs[0].resize(100, 'f');
txs[1].resize(200, 'e');
ASSERT_EQ(10u, contexts_.size());
{
@ -472,6 +472,7 @@ TEST_F(levin_notify, flood)
for (++context; context != contexts_.end(); ++context)
EXPECT_EQ(1u, context->process_send_queue());
std::sort(txs.begin(), txs.end());
ASSERT_EQ(9u, receiver_.notified_size());
for (unsigned count = 0; count < 9; ++count)
{
@ -492,6 +493,7 @@ TEST_F(levin_notify, flood)
for (++context; context != contexts_.end(); ++context)
EXPECT_EQ(1u, context->process_send_queue());
std::sort(txs.begin(), txs.end());
ASSERT_EQ(9u, receiver_.notified_size());
for (unsigned count = 0; count < 9; ++count)
{
@ -523,8 +525,8 @@ TEST_F(levin_notify, private_flood)
}
std::vector<cryptonote::blobdata> txs(2);
txs[0].resize(100, 'e');
txs[1].resize(200, 'f');
txs[0].resize(100, 'f');
txs[1].resize(200, 'e');
ASSERT_EQ(10u, contexts_.size());
{