nano-node icon indicating copy to clipboard operation
nano-node copied to clipboard

is_bootstrap_connection() does not do what it says

Open dsiganos opened this issue 2 years ago • 2 comments

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;
}

dsiganos avatar Oct 08 '21 18:10 dsiganos

What are we wanting to happen here? Just for the function to be renamed so it's more obvious what's going on?

not-Ian avatar Jul 18 '22 01:07 not-Ian

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

pwojcikdev avatar Jul 18 '22 08:07 pwojcikdev

@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

qwahzi avatar Jan 09 '23 18:01 qwahzi