This removes debug checks for is_dev_network in several places that don't directly have access to the network constants. node_rpc_config::set_request_callback is used for testing though nothing functionally requires it to be called from a unit test context. write_database_queue::contains checks that it's only called in a unit test context though this is also not functionally required. Calling the count function on several of the db tables has a performance impact though nothing about it is functionally incorrect and the caller needs to determine if the performance hit is acceptable.

This commit is contained in:
clemahieu 2021-08-09 12:08:07 +01:00
commit 013104cbb4
No known key found for this signature in database
GPG key ID: 43708520C8DFB938
3 changed files with 1 additions and 4 deletions

View file

@ -59,6 +59,5 @@ nano::error nano::node_rpc_config::deserialize_json (bool & upgraded_a, nano::js
void nano::node_rpc_config::set_request_callback (std::function<void (boost::property_tree::ptree const &)> callback_a)
{
debug_assert (nano::network_constants ().is_dev_network ());
request_callback = std::move (callback_a);
}

View file

@ -542,7 +542,6 @@ uint64_t nano::rocksdb_store::count (nano::transaction const & transaction_a, ta
// otherwise there can be performance issues.
else if (table_a == tables::accounts)
{
debug_assert (network_constants ().is_dev_network ());
for (auto i (account.begin (transaction_a)), n (account.end ()); i != n; ++i)
{
++sum;
@ -558,7 +557,6 @@ uint64_t nano::rocksdb_store::count (nano::transaction const & transaction_a, ta
}
else if (table_a == tables::confirmation_height)
{
debug_assert (network_constants ().is_dev_network ());
for (auto i (confirmation_height.begin (transaction_a)), n (confirmation_height.end ()); i != n; ++i)
{
++sum;

View file

@ -90,7 +90,7 @@ nano::write_guard nano::write_database_queue::wait (nano::writer writer)
bool nano::write_database_queue::contains (nano::writer writer)
{
debug_assert (!use_noops && nano::network_constants ().is_dev_network ());
debug_assert (!use_noops);
nano::lock_guard<nano::mutex> guard (mutex);
return std::find (queue.cbegin (), queue.cend (), writer) != queue.cend ();
}