Increase minimum supported protocol version to 17 (#2683)

Node version 19
This commit is contained in:
Sergey Kroshnin 2020-03-27 14:30:45 +03:00 committed by GitHub
commit df74fb729e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 24 deletions

View file

@ -229,7 +229,7 @@ void nano::active_transactions::request_confirm (nano::unique_lock<std::mutex> &
// Only representatives ready to receive batched confirm_req // Only representatives ready to receive batched confirm_req
nano::confirmation_solicitor solicitor (node.network, node.network_params.network); nano::confirmation_solicitor solicitor (node.network, node.network_params.network);
solicitor.prepare (node.rep_crawler.principal_representatives (std::numeric_limits<size_t>::max (), node.network_params.protocol.tcp_realtime_protocol_version_min)); solicitor.prepare (node.rep_crawler.principal_representatives (std::numeric_limits<size_t>::max ()));
bool const representative_l (node.config.enable_voting && node.wallets.rep_counts ().voting > 0); bool const representative_l (node.config.enable_voting && node.wallets.rep_counts ().voting > 0);
std::vector<nano::block_hash> hashes_generation_l; std::vector<nano::block_hash> hashes_generation_l;

View file

@ -217,17 +217,8 @@ void nano::network::flood_block_many (std::deque<std::shared_ptr<nano::block>> b
void nano::network::send_confirm_req (std::shared_ptr<nano::transport::channel> channel_a, std::shared_ptr<nano::block> block_a) void nano::network::send_confirm_req (std::shared_ptr<nano::transport::channel> channel_a, std::shared_ptr<nano::block> block_a)
{ {
// Confirmation request with hash + root // Confirmation request with hash + root
if (channel_a->get_network_version () >= node.network_params.protocol.tcp_realtime_protocol_version_min)
{
nano::confirm_req req (block_a->hash (), block_a->root ()); nano::confirm_req req (block_a->hash (), block_a->root ());
channel_a->send (req); channel_a->send (req);
}
// Confirmation request with full block
else
{
nano::confirm_req req (block_a);
channel_a->send (req);
}
} }
void nano::network::broadcast_confirm_req (std::shared_ptr<nano::block> block_a) void nano::network::broadcast_confirm_req (std::shared_ptr<nano::block> block_a)
@ -635,14 +626,13 @@ nano::tcp_endpoint nano::network::bootstrap_peer (bool lazy_bootstrap)
{ {
nano::tcp_endpoint result (boost::asio::ip::address_v6::any (), 0); nano::tcp_endpoint result (boost::asio::ip::address_v6::any (), 0);
bool use_udp_peer (nano::random_pool::generate_word32 (0, 1)); bool use_udp_peer (nano::random_pool::generate_word32 (0, 1));
auto protocol_min (lazy_bootstrap ? node.network_params.protocol.protocol_version_bootstrap_lazy_min : node.network_params.protocol.protocol_version_bootstrap_min);
if (use_udp_peer || tcp_channels.size () == 0) if (use_udp_peer || tcp_channels.size () == 0)
{ {
result = udp_channels.bootstrap_peer (protocol_min); result = udp_channels.bootstrap_peer (node.network_params.protocol.protocol_version_bootstrap_min);
} }
if (result == nano::tcp_endpoint (boost::asio::ip::address_v6::any (), 0)) if (result == nano::tcp_endpoint (boost::asio::ip::address_v6::any (), 0))
{ {
result = tcp_channels.bootstrap_peer (protocol_min); result = tcp_channels.bootstrap_peer (node.network_params.protocol.protocol_version_bootstrap_min);
} }
return result; return result;
} }

View file

@ -439,7 +439,7 @@ void nano::transport::tcp_channels::ongoing_keepalive ()
size_t random_count (std::min (static_cast<size_t> (6), static_cast<size_t> (std::ceil (std::sqrt (node.network.udp_channels.size ()))))); size_t random_count (std::min (static_cast<size_t> (6), static_cast<size_t> (std::ceil (std::sqrt (node.network.udp_channels.size ())))));
for (auto i (0); i <= random_count; ++i) for (auto i (0); i <= random_count; ++i)
{ {
auto tcp_endpoint (node.network.udp_channels.bootstrap_peer (node.network_params.protocol.tcp_realtime_protocol_version_min)); auto tcp_endpoint (node.network.udp_channels.bootstrap_peer (node.network_params.protocol.protocol_version_min));
if (tcp_endpoint != invalid_endpoint && find_channel (tcp_endpoint) == nullptr) if (tcp_endpoint != invalid_endpoint && find_channel (tcp_endpoint) == nullptr)
{ {
start_tcp (nano::transport::map_tcp_to_endpoint (tcp_endpoint)); start_tcp (nano::transport::map_tcp_to_endpoint (tcp_endpoint));

View file

@ -358,16 +358,10 @@ public:
uint8_t protocol_version = 0x12; uint8_t protocol_version = 0x12;
/** Minimum accepted protocol version */ /** Minimum accepted protocol version */
uint8_t protocol_version_min = 0x10; uint8_t protocol_version_min = 0x11;
/** Do not bootstrap from nodes older than this version. */ /** Do not bootstrap from nodes older than this version. */
uint8_t protocol_version_bootstrap_min = 0x10; uint8_t protocol_version_bootstrap_min = 0x11;
/** Do not lazy bootstrap from nodes older than this version. */
uint8_t protocol_version_bootstrap_lazy_min = 0x10;
/** Do not start TCP realtime network connections to nodes older than this version */
uint8_t tcp_realtime_protocol_version_min = 0x11;
/** Do not request telemetry metrics to nodes older than this version */ /** Do not request telemetry metrics to nodes older than this version */
uint8_t telemetry_protocol_version_min = 0x12; uint8_t telemetry_protocol_version_min = 0x12;