nano-node
nano-node copied to clipboard
is_bootstrap_connection() does not do what it says
The function is_bootstrap_connection does not do what it says. It implies that it simply checks if a connection is bootstrap or not but, in fact, it does a lot more that than. It should be refactored to be safer.
bool nano::bootstrap_server::is_bootstrap_connection ()
{
if (socket->type () == nano::socket::type_t::undefined && !node->flags.disable_bootstrap_listener && node->bootstrap.bootstrap_count < node->config.bootstrap_connections_max)
{
++node->bootstrap.bootstrap_count;
socket->type_set (nano::socket::type_t::bootstrap);
}
return socket->type () == nano::socket::type_t::bootstrap;
}
What are we wanting to happen here? Just for the function to be renamed so it's more obvious what's going on?
is_bootstrap_connection
should be const so it can't modify the state, but this issue will be fixed by https://github.com/nanocurrency/nano-node/pull/3861
@dsiganos Is this another issue that can be closed, given the related PR that has already been merged? https://github.com/nanocurrency/nano-node/pull/3861