diff options
author | Lee Clagett <code@leeclagett.com> | 2019-10-27 22:32:04 +0000 |
---|---|---|
committer | Lee Clagett <code@leeclagett.com> | 2019-11-04 09:23:20 +0000 |
commit | 70c9cd3c9cd052716c309a0bd9b77009318f4131 (patch) | |
tree | 9d7bc9f3b20cd15c93cda4b6607d0ae6435608b2 /src/p2p/net_node.inl | |
parent | Merge pull request #6057 (diff) | |
download | monero-70c9cd3c9cd052716c309a0bd9b77009318f4131.tar.xz |
Change to Tx diffusion (Dandelion++ fluff) instead of flooding
Diffstat (limited to 'src/p2p/net_node.inl')
-rw-r--r-- | src/p2p/net_node.inl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 45bb10593..5dab251b5 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -116,6 +116,7 @@ namespace nodetool command_line::add_arg(desc, arg_limit_rate_up); command_line::add_arg(desc, arg_limit_rate_down); command_line::add_arg(desc, arg_limit_rate); + command_line::add_arg(desc, arg_pad_transactions); } //----------------------------------------------------------------------------------- template<class t_payload_net_handler> @@ -340,6 +341,7 @@ namespace nodetool { bool testnet = command_line::get_arg(vm, cryptonote::arg_testnet_on); bool stagenet = command_line::get_arg(vm, cryptonote::arg_stagenet_on); + const bool pad_txs = command_line::get_arg(vm, arg_pad_transactions); m_nettype = testnet ? cryptonote::TESTNET : stagenet ? cryptonote::STAGENET : cryptonote::MAINNET; network_zone& public_zone = m_network_zones[epee::net_utils::zone::public_]; @@ -384,7 +386,7 @@ namespace nodetool m_use_ipv6 = command_line::get_arg(vm, arg_p2p_use_ipv6); m_require_ipv4 = !command_line::get_arg(vm, arg_p2p_ignore_ipv4); public_zone.m_notifier = cryptonote::levin::notify{ - public_zone.m_net_server.get_io_service(), public_zone.m_net_server.get_config_shared(), nullptr, true + public_zone.m_net_server.get_io_service(), public_zone.m_net_server.get_config_shared(), nullptr, true, pad_txs }; if (command_line::has_arg(vm, arg_p2p_add_peer)) @@ -495,7 +497,7 @@ namespace nodetool } zone.m_notifier = cryptonote::levin::notify{ - zone.m_net_server.get_io_service(), zone.m_net_server.get_config_shared(), std::move(this_noise), false + zone.m_net_server.get_io_service(), zone.m_net_server.get_config_shared(), std::move(this_noise), false, pad_txs }; } @@ -2053,18 +2055,18 @@ namespace nodetool } //----------------------------------------------------------------------------------- template<class t_payload_net_handler> - epee::net_utils::zone node_server<t_payload_net_handler>::send_txs(std::vector<cryptonote::blobdata> txs, const epee::net_utils::zone origin, const boost::uuids::uuid& source, cryptonote::i_core_events& core, const bool pad_txs) + epee::net_utils::zone node_server<t_payload_net_handler>::send_txs(std::vector<cryptonote::blobdata> txs, const epee::net_utils::zone origin, const boost::uuids::uuid& source, cryptonote::i_core_events& core) { namespace enet = epee::net_utils; - const auto send = [&txs, &source, &core, pad_txs] (std::pair<const enet::zone, network_zone>& network) + const auto send = [&txs, &source, &core] (std::pair<const enet::zone, network_zone>& network) { const bool is_public = (network.first == enet::zone::public_); const cryptonote::relay_method tx_relay = is_public ? - cryptonote::relay_method::flood : cryptonote::relay_method::local; + cryptonote::relay_method::fluff : cryptonote::relay_method::local; core.on_transactions_relayed(epee::to_span(txs), tx_relay); - if (network.second.m_notifier.send_txs(std::move(txs), source, (pad_txs || !is_public))) + if (network.second.m_notifier.send_txs(std::move(txs), source)) return network.first; return enet::zone::invalid; }; |