From 7c45401d798112dd4858361f93ae6964cfd16254 Mon Sep 17 00:00:00 2001 From: gr0vity-dev Date: Mon, 6 May 2024 12:02:17 +0200 Subject: [PATCH 1/5] feat: introduce active_transactions_config --- nano/node/active_transactions.cpp | 44 ++++++++++++++++++++++++++----- nano/node/active_transactions.hpp | 27 ++++++++++++++++++- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/nano/node/active_transactions.cpp b/nano/node/active_transactions.cpp index 1164f5fdec..dbff6b5b18 100644 --- a/nano/node/active_transactions.cpp +++ b/nano/node/active_transactions.cpp @@ -18,11 +18,12 @@ using namespace std::chrono; nano::active_transactions::active_transactions (nano::node & node_a, nano::confirming_set & confirming_set, nano::block_processor & block_processor_a) : + config{ node_a.config.active_transactions }, node{ node_a }, confirming_set{ confirming_set }, block_processor{ block_processor_a }, - recently_confirmed{ 65536 }, - recently_cemented{ node.config.confirmation_history_size }, + recently_confirmed{ config.confirmation_cache }, + recently_cemented{ config.confirmation_history_size }, election_time_to_live{ node_a.network_params.network.is_dev_network () ? 0s : 2s } { count_by_behavior.fill (0); // Zero initialize array @@ -187,16 +188,16 @@ int64_t nano::active_transactions::limit (nano::election_behavior behavior) cons { case nano::election_behavior::normal: { - return static_cast (node.config.active_elections_size); + return static_cast (config.size); } case nano::election_behavior::hinted: { - const uint64_t limit = node.config.active_elections_hinted_limit_percentage * node.config.active_elections_size / 100; + const uint64_t limit = config.hinted_limit_percentage * config.size / 100; return static_cast (limit); } case nano::election_behavior::optimistic: { - const uint64_t limit = node.config.active_elections_optimistic_limit_percentage * node.config.active_elections_size / 100; + const uint64_t limit = config.optimistic_limit_percentage * config.size / 100; return static_cast (limit); } } @@ -239,7 +240,7 @@ void nano::active_transactions::request_confirm (nano::unique_lock * Loop through active elections in descending order of proof-of-work difficulty, requesting confirmation * * Only up to a certain amount of elections are queued for confirmation request and block rebroadcasting. The remaining elections can still be confirmed if votes arrive - * Elections extending the soft config.active_elections_size limit are flushed after a certain time-to-live cutoff + * Elections extending the soft config.size limit are flushed after a certain time-to-live cutoff * Flushed elections are later re-activated via frontier confirmation */ for (auto const & election_l : elections_l) @@ -764,3 +765,34 @@ std::unique_ptr nano::recently_cemented_cache::c composite->add_component (std::make_unique (container_info{ "cemented", cemented.size (), sizeof (decltype (cemented)::value_type) })); return composite; } + + +/* + * active_transactions_config + */ + +nano::active_transactions_config::active_transactions_config (const nano::network_constants & network_constants) +{ +} + +nano::error nano::active_transactions_config::serialize (nano::tomlconfig & toml) const +{ + toml.put ("size", size, "Number of active elections. Elections beyond this limit have limited survival time.\nWarning: modifying this value may result in a lower confirmation rate. \ntype:uint64,[250..]"); + toml.put ("hinted_limit_percentage", hinted_limit_percentage, "Limit of hinted elections as percentage of `active_elections_size` \ntype:uint64"); + toml.put ("optimistic_limit_percentage", optimistic_limit_percentage, "Limit of optimistic elections as percentage of `active_elections_size`. \ntype:uint64"); + toml.put ("confirmation_history_size", confirmation_history_size, "Maximum confirmation history size. If tracking the rate of block confirmations, the websocket feature is recommended instead. \ntype:uint64"); + toml.put ("confirmation_cache", confirmation_cache, "Maximum number of confirmed elections kept in cache to prevent restarting an election. \ntype:uint64"); + + return toml.get_error (); +} + +nano::error nano::active_transactions_config::deserialize (nano::tomlconfig & toml) +{ + toml.get ("size", size); + toml.get ("hinted_limit_percentage", hinted_limit_percentage); + toml.get ("optimistic_limit_percentage", optimistic_limit_percentage); + toml.get ("confirmation_history_size", confirmation_history_size); + toml.get ("confirmation_cache", confirmation_cache); + + return toml.get_error (); +} diff --git a/nano/node/active_transactions.hpp b/nano/node/active_transactions.hpp index dcff01a678..2183da1634 100644 --- a/nano/node/active_transactions.hpp +++ b/nano/node/active_transactions.hpp @@ -41,6 +41,30 @@ class read_transaction; namespace nano { +class active_transactions_config final +{ +public: + explicit active_transactions_config (nano::network_constants const &); + + nano::error deserialize (nano::tomlconfig & toml); + nano::error serialize (nano::tomlconfig & toml) const; + +public: + // Maximum number of simultaneous active elections (AEC size) + std::size_t size{ 5000 }; + // Limit of hinted elections as percentage of `active_elections_size` + std::size_t hinted_limit_percentage{ 20 }; + // Limit of optimistic elections as percentage of `active_elections_size` + std::size_t optimistic_limit_percentage{ 10 }; + // Maximum confirmation history size + std::size_t confirmation_history_size{ 2048 }; + // Maximum cache size for recently_confirmed + std::size_t confirmation_cache{ 65536 }; + + + +}; + class recently_confirmed_cache final { public: @@ -209,7 +233,8 @@ class active_transactions final bool trigger_vote_cache (nano::block_hash); private: // Dependencies - nano::node & node; + active_transactions_config const & config; + nano::node & node; nano::confirming_set & confirming_set; nano::block_processor & block_processor; From b3bb7af9ff8af31797a8863d103ea47d34511bfd Mon Sep 17 00:00:00 2001 From: gr0vity-dev Date: Mon, 6 May 2024 12:03:44 +0200 Subject: [PATCH 2/5] add active_transaction_config to nodeconfig - remove old config variables --- nano/node/nodeconfig.cpp | 23 +++++++++++++++-------- nano/node/nodeconfig.hpp | 10 +++------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/nano/node/nodeconfig.cpp b/nano/node/nodeconfig.cpp index ca9bda3679..ee5d2c5318 100644 --- a/nano/node/nodeconfig.cpp +++ b/nano/node/nodeconfig.cpp @@ -34,6 +34,7 @@ nano::node_config::node_config (const std::optional & peering_port_a, ipc_config{ network_params.network }, external_address{ boost::asio::ip::address_v6{}.to_string () }, rep_crawler{ network_params.network }, + active_transactions{ network_params.network }, block_processor{ network_params.network }, peer_history{ network_params.network }, tcp{ network_params.network } @@ -119,9 +120,7 @@ nano::error nano::node_config::serialize_toml (nano::tomlconfig & toml) const toml.put ("external_port", external_port, "The external port number of this node (NAT). Only used if external_address is set.\ntype:uint16"); toml.put ("tcp_incoming_connections_max", tcp_incoming_connections_max, "Maximum number of incoming TCP connections.\ntype:uint64"); toml.put ("use_memory_pools", use_memory_pools, "If true, allocate memory from memory pools. Enabling this may improve performance. Memory is never released to the OS.\ntype:bool"); - toml.put ("confirmation_history_size", confirmation_history_size, "Maximum confirmation history size. If tracking the rate of block confirmations, the websocket feature is recommended instead.\ntype:uint64"); - toml.put ("active_elections_size", active_elections_size, "Number of active elections. Elections beyond this limit have limited survival time.\nWarning: modifying this value may result in a lower confirmation rate.\ntype:uint64,[250..]"); - + toml.put ("bandwidth_limit", bandwidth_limit, "Outbound traffic limit in bytes/sec after which messages will be dropped.\nNote: changing to unlimited bandwidth (0) is not recommended for limited connections.\ntype:uint64"); toml.put ("bandwidth_limit_burst_ratio", bandwidth_limit_burst_ratio, "Burst ratio for outbound traffic shaping.\ntype:double"); @@ -218,6 +217,10 @@ nano::error nano::node_config::serialize_toml (nano::tomlconfig & toml) const rep_crawler.serialize (rep_crawler_l); toml.put_child ("rep_crawler", rep_crawler_l); + nano::tomlconfig active_transactions_l; + active_transactions.serialize (active_transactions_l); + toml.put_child ("active_transactions", active_transactions_l); + nano::tomlconfig block_processor_l; block_processor.serialize (block_processor_l); toml.put_child ("block_processor", block_processor_l); @@ -311,6 +314,12 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml) rep_crawler.deserialize (config_l); } + if (toml.has_key ("active_transactions")) + { + auto config_l = toml.get_required_child ("active_transactions"); + active_transactions.deserialize (config_l); + } + if (toml.has_key ("block_processor")) { auto config_l = toml.get_required_child ("block_processor"); @@ -459,9 +468,7 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml) toml.get (pow_sleep_interval_key, pow_sleep_interval_l); pow_sleep_interval = std::chrono::nanoseconds (pow_sleep_interval_l); toml.get ("use_memory_pools", use_memory_pools); - toml.get ("confirmation_history_size", confirmation_history_size); - toml.get ("active_elections_size", active_elections_size); - + toml.get ("bandwidth_limit", bandwidth_limit); toml.get ("bandwidth_limit_burst_ratio", bandwidth_limit_burst_ratio); @@ -524,9 +531,9 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml) { toml.get_error ().set ("io_threads must be non-zero"); } - if (active_elections_size <= 250 && !network_params.network.is_dev_network ()) + if (active_transactions.size <= 250 && !network_params.network.is_dev_network ()) { - toml.get_error ().set ("active_elections_size must be greater than 250"); + toml.get_error ().set ("active_transactions.size must be greater than 250"); } if (bandwidth_limit > std::numeric_limits::max ()) { diff --git a/nano/node/nodeconfig.hpp b/nano/node/nodeconfig.hpp index 8f2defda79..a8ec08b4bf 100644 --- a/nano/node/nodeconfig.hpp +++ b/nano/node/nodeconfig.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -90,7 +91,6 @@ class node_config uint32_t bootstrap_frontier_request_count{ 1024 * 1024 }; nano::websocket::config websocket_config; nano::diagnostics_config diagnostics_config; - std::size_t confirmation_history_size{ 2048 }; std::string callback_address; uint16_t callback_port{ 0 }; std::string callback_target; @@ -104,12 +104,7 @@ class node_config /** Timeout for initiated async operations */ std::chrono::seconds tcp_io_timeout{ (network_params.network.is_dev_network () && !is_sanitizer_build ()) ? std::chrono::seconds (5) : std::chrono::seconds (15) }; std::chrono::nanoseconds pow_sleep_interval{ 0 }; - // TODO: Move related settings to `active_transactions_config` class - std::size_t active_elections_size{ 5000 }; - /** Limit of hinted elections as percentage of `active_elections_size` */ - std::size_t active_elections_hinted_limit_percentage{ 20 }; - /** Limit of optimistic elections as percentage of `active_elections_size` */ - std::size_t active_elections_optimistic_limit_percentage{ 10 }; + /** Default maximum incoming TCP connections, including realtime network & bootstrap */ unsigned tcp_incoming_connections_max{ 2048 }; bool use_memory_pools{ true }; @@ -142,6 +137,7 @@ class node_config nano::vote_cache_config vote_cache; nano::rep_crawler_config rep_crawler; nano::block_processor_config block_processor; + nano::active_transactions_config active_transactions; nano::vote_processor_config vote_processor; nano::peer_history_config peer_history; nano::transport::tcp_config tcp; From 0688d964cf2569b701566197134453531d42bc63 Mon Sep 17 00:00:00 2001 From: gr0vity-dev Date: Mon, 6 May 2024 12:05:32 +0200 Subject: [PATCH 3/5] replace old config varibales usages - active_elections_size - active_elections_hinted_limit_percentage - active_elections_optimistic_limit_percentage - confirmation_history_size --- nano/core_test/active_transactions.cpp | 20 ++++++++++---------- nano/core_test/blockprocessor.cpp | 4 ++-- nano/core_test/election_scheduler.cpp | 4 ++-- nano/core_test/ledger.cpp | 22 +++++++++++----------- nano/core_test/toml.cpp | 21 ++++++++++++--------- nano/core_test/voting.cpp | 4 ++-- nano/nano_node/entry.cpp | 2 +- nano/node/json_handler.cpp | 2 +- nano/slow_test/node.cpp | 2 +- 9 files changed, 42 insertions(+), 39 deletions(-) diff --git a/nano/core_test/active_transactions.cpp b/nano/core_test/active_transactions.cpp index 21c8931970..931598d496 100644 --- a/nano/core_test/active_transactions.cpp +++ b/nano/core_test/active_transactions.cpp @@ -163,7 +163,7 @@ TEST (active_transactions, keep_local) nano::node_config node_config = system.default_config (); node_config.enable_voting = false; // Bound to 2, won't drop wallet created transactions, but good to test dropping remote - node_config.active_elections_size = 2; + node_config.active_transactions.size = 2; // Disable frontier confirmation to allow the test to finish before node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; @@ -234,7 +234,7 @@ TEST (active_transactions, keep_local) node.process_active (receive3); /// bound elections, should drop after one loop - ASSERT_TIMELY_EQ (5s, node.active.size (), node_config.active_elections_size); + ASSERT_TIMELY_EQ (5s, node.active.size (), node_config.active_transactions.size); // ASSERT_EQ (1, node.scheduler.size ()); } @@ -1318,7 +1318,7 @@ TEST (active_transactions, vacancy) { nano::test::system system; nano::node_config config = system.default_config (); - config.active_elections_size = 1; + config.active_transactions.size = 1; auto & node = *system.add_node (config); nano::state_block_builder builder; auto send = builder.make_block () @@ -1354,7 +1354,7 @@ TEST (active_transactions, fifo) nano::test::system system{}; nano::node_config config = system.default_config (); - config.active_elections_size = 1; + config.active_transactions.size = 1; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; auto & node = *system.add_node (config); @@ -1441,8 +1441,8 @@ TEST (active_transactions, limit_vote_hinted_elections) const int aec_limit = 10; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; config.optimistic_scheduler.enabled = false; - config.active_elections_size = aec_limit; - config.active_elections_hinted_limit_percentage = 10; // Should give us a limit of 1 hinted election + config.active_transactions.size = aec_limit; + config.active_transactions.hinted_limit_percentage = 10; // Should give us a limit of 1 hinted election auto & node = *system.add_node (config); // Setup representatives @@ -1506,8 +1506,8 @@ TEST (active_transactions, allow_limited_overflow) nano::node_config config = system.default_config (); const int aec_limit = 20; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; - config.active_elections_size = aec_limit; - config.active_elections_hinted_limit_percentage = 20; // Should give us a limit of 4 hinted elections + config.active_transactions.size = aec_limit; + config.active_transactions.hinted_limit_percentage = 20; // Should give us a limit of 4 hinted elections auto & node = *system.add_node (config); auto blocks = nano::test::setup_independent_blocks (system, node, aec_limit * 4); @@ -1555,8 +1555,8 @@ TEST (active_transactions, allow_limited_overflow_adapt) nano::node_config config = system.default_config (); const int aec_limit = 20; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; - config.active_elections_size = aec_limit; - config.active_elections_hinted_limit_percentage = 20; // Should give us a limit of 4 hinted elections + config.active_transactions.size = aec_limit; + config.active_transactions.hinted_limit_percentage = 20; // Should give us a limit of 4 hinted elections auto & node = *system.add_node (config); auto blocks = nano::test::setup_independent_blocks (system, node, aec_limit * 4); diff --git a/nano/core_test/blockprocessor.cpp b/nano/core_test/blockprocessor.cpp index ad7b3fffaa..3050947d3f 100644 --- a/nano/core_test/blockprocessor.cpp +++ b/nano/core_test/blockprocessor.cpp @@ -16,9 +16,9 @@ TEST (block_processor, broadcast_block_on_arrival) nano::test::system system; nano::node_config config1 = system.default_config (); // Deactivates elections on both nodes. - config1.active_elections_size = 0; + config1.active_transactions.size = 0; nano::node_config config2 = system.default_config (); - config2.active_elections_size = 0; + config2.active_transactions.size = 0; nano::node_flags flags; // Disables bootstrap listener to make sure the block won't be shared by this channel. flags.disable_bootstrap_listener = true; diff --git a/nano/core_test/election_scheduler.cpp b/nano/core_test/election_scheduler.cpp index be1ba4cfed..7abd60aa15 100644 --- a/nano/core_test/election_scheduler.cpp +++ b/nano/core_test/election_scheduler.cpp @@ -56,7 +56,7 @@ TEST (election_scheduler, activate_one_flush) /** * Tests that the election scheduler and the active transactions container (AEC) - * work in sync with regards to the node configuration value "active_elections_size". + * work in sync with regards to the node configuration value "active_transactions.size". * * The test sets up two forcefully cemented blocks -- a send on the genesis account and a receive on a second account. * It then creates two other blocks, each a successor to one of the previous two, @@ -74,7 +74,7 @@ TEST (election_scheduler, no_vacancy) nano::test::system system{}; nano::node_config config = system.default_config (); - config.active_elections_size = 1; + config.active_transactions.size = 1; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; auto & node = *system.add_node (config); diff --git a/nano/core_test/ledger.cpp b/nano/core_test/ledger.cpp index 6307f07a04..dbfabf86be 100644 --- a/nano/core_test/ledger.cpp +++ b/nano/core_test/ledger.cpp @@ -128,7 +128,7 @@ TEST (ledger, process_send) ASSERT_EQ (2, send->sideband ().height); ASSERT_EQ (nano::dev::constants.genesis_amount - 50, ledger.any.block_amount (transaction, hash1)); ASSERT_EQ (nano::dev::genesis_key.pub, send->account ()); - ASSERT_EQ (50, ledger.any.account_balance (transaction, nano::dev::genesis_key.pub).value ().number ()); + ASSERT_EQ (50, ledger.any.account_balance (transaction, nano::dev::genesis_key.pub)); ASSERT_EQ (nano::dev::constants.genesis_amount - 50, ledger.account_receivable (transaction, key2.pub)); auto info2 = ledger.any.account_get (transaction, nano::dev::genesis_key.pub); ASSERT_TRUE (info2); @@ -264,19 +264,19 @@ TEST (ledger, process_receive) ASSERT_EQ (key2.pub, receive->sideband ().account); ASSERT_EQ (nano::dev::constants.genesis_amount - 25, receive->sideband ().balance.number ()); ASSERT_EQ (2, receive->sideband ().height); - ASSERT_EQ (25, ledger.any.block_amount (transaction, hash4).value ().number ()); + ASSERT_EQ (25, ledger.any.block_amount (transaction, hash4)); ASSERT_EQ (nano::block_status::progress, return2); ASSERT_EQ (key2.pub, receive->account ()); ASSERT_EQ (hash4, ledger.any.account_head (transaction, key2.pub)); - ASSERT_EQ (25, ledger.any.account_balance (transaction, nano::dev::genesis_key.pub).value ().number ()); + ASSERT_EQ (25, ledger.any.account_balance (transaction, nano::dev::genesis_key.pub)); ASSERT_EQ (0, ledger.account_receivable (transaction, key2.pub)); - ASSERT_EQ (nano::dev::constants.genesis_amount - 25, ledger.any.account_balance (transaction, key2.pub).value ().number ()); + ASSERT_EQ (nano::dev::constants.genesis_amount - 25, ledger.any.account_balance (transaction, key2.pub)); ASSERT_EQ (nano::dev::constants.genesis_amount - 25, ledger.weight (key3.pub)); ASSERT_FALSE (ledger.rollback (transaction, hash4)); ASSERT_FALSE (ledger.any.block_successor (transaction, hash2)); - ASSERT_EQ (25, ledger.any.account_balance (transaction, nano::dev::genesis_key.pub).value ().number ()); + ASSERT_EQ (25, ledger.any.account_balance (transaction, nano::dev::genesis_key.pub)); ASSERT_EQ (25, ledger.account_receivable (transaction, key2.pub)); - ASSERT_EQ (nano::dev::constants.genesis_amount - 50, ledger.any.account_balance (transaction, key2.pub).value ().number ()); + ASSERT_EQ (nano::dev::constants.genesis_amount - 50, ledger.any.account_balance (transaction, key2.pub)); ASSERT_EQ (nano::dev::constants.genesis_amount - 50, ledger.weight (key3.pub)); ASSERT_EQ (hash2, ledger.any.account_head (transaction, key2.pub)); auto pending1 = ledger.any.pending_get (transaction, nano::pending_key (key2.pub, hash3)); @@ -319,7 +319,7 @@ TEST (ledger, rollback_receiver) nano::block_hash hash2 (open->hash ()); ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open)); ASSERT_EQ (hash2, ledger.any.account_head (transaction, key2.pub)); - ASSERT_EQ (50, ledger.any.account_balance (transaction, nano::dev::genesis_key.pub).value ().number ()); + ASSERT_EQ (50, ledger.any.account_balance (transaction, nano::dev::genesis_key.pub)); ASSERT_EQ (nano::dev::constants.genesis_amount - 50, ledger.any.account_balance (transaction, key2.pub)); ASSERT_EQ (50, ledger.weight (nano::dev::genesis_key.pub)); ASSERT_EQ (0, ledger.weight (key2.pub)); @@ -527,7 +527,7 @@ TEST (ledger, representative_change) .build (); auto return1 (ledger.process (transaction, block)); ASSERT_EQ (nano::block_status::progress, return1); - ASSERT_EQ (0, ledger.any.block_amount (transaction, block->hash ()).value ().number ()); + ASSERT_EQ (0, ledger.any.block_amount (transaction, block->hash ())); ASSERT_EQ (nano::dev::genesis_key.pub, block->account ()); ASSERT_EQ (0, ledger.weight (nano::dev::genesis_key.pub)); ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.weight (key2.pub)); @@ -2543,7 +2543,7 @@ TEST (ledger, state_rep_change) ASSERT_NE (nullptr, change2); ASSERT_EQ (*change1, *change2); ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.any.block_balance (transaction, change1->hash ())); - ASSERT_EQ (0, ledger.any.block_amount (transaction, change1->hash ()).value ().number ()); + ASSERT_EQ (0, ledger.any.block_amount (transaction, change1->hash ())); ASSERT_EQ (0, ledger.weight (nano::dev::genesis_key.pub)); ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.weight (rep.pub)); ASSERT_EQ (2, change2->sideband ().height); @@ -3563,7 +3563,7 @@ TEST (ledger, epoch_blocks_v1_general) ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive2)); ASSERT_EQ (nano::epoch::epoch_1, receive2->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_1, receive2->sideband ().source_epoch); - ASSERT_EQ (0, ledger.any.block_balance (transaction, epoch4->hash ()).value ().number ()); + ASSERT_EQ (0, ledger.any.block_balance (transaction, epoch4->hash ())); ASSERT_EQ (nano::Gxrb_ratio, ledger.any.block_balance (transaction, receive2->hash ())); ASSERT_EQ (nano::Gxrb_ratio, ledger.any.block_amount (transaction, receive2->hash ())); ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.weight (nano::dev::genesis_key.pub)); @@ -3731,7 +3731,7 @@ TEST (ledger, epoch_blocks_v2_general) ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive2)); ASSERT_EQ (nano::epoch::epoch_2, receive2->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_1, receive2->sideband ().source_epoch); - ASSERT_EQ (0, ledger.any.block_balance (transaction, epoch6->hash ()).value ().number ()); + ASSERT_EQ (0, ledger.any.block_balance (transaction, epoch6->hash ())); ASSERT_EQ (nano::Gxrb_ratio, ledger.any.block_balance (transaction, receive2->hash ())); ASSERT_EQ (nano::Gxrb_ratio, ledger.any.block_amount (transaction, receive2->hash ())); ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.weight (nano::dev::genesis_key.pub)); diff --git a/nano/core_test/toml.cpp b/nano/core_test/toml.cpp index 886461df67..dc1ed2fa44 100644 --- a/nano/core_test/toml.cpp +++ b/nano/core_test/toml.cpp @@ -152,7 +152,7 @@ TEST (toml, daemon_config_deserialize_defaults) ASSERT_EQ (conf.rpc.child_process.enable, defaults.rpc.child_process.enable); ASSERT_EQ (conf.rpc.child_process.rpc_path, defaults.rpc.child_process.rpc_path); - ASSERT_EQ (conf.node.active_elections_size, defaults.node.active_elections_size); + ASSERT_EQ (conf.node.active_transactions.size, defaults.node.active_transactions.size); ASSERT_EQ (conf.node.allow_local_peers, defaults.node.allow_local_peers); ASSERT_EQ (conf.node.backup_before_upgrade, defaults.node.backup_before_upgrade); ASSERT_EQ (conf.node.bandwidth_limit, defaults.node.bandwidth_limit); @@ -167,7 +167,6 @@ TEST (toml, daemon_config_deserialize_defaults) ASSERT_EQ (conf.node.bootstrap_frontier_request_count, defaults.node.bootstrap_frontier_request_count); ASSERT_EQ (conf.node.bootstrap_fraction_numerator, defaults.node.bootstrap_fraction_numerator); ASSERT_EQ (conf.node.confirming_set_batch_time, defaults.node.confirming_set_batch_time); - ASSERT_EQ (conf.node.confirmation_history_size, defaults.node.confirmation_history_size); ASSERT_EQ (conf.node.enable_voting, defaults.node.enable_voting); ASSERT_EQ (conf.node.external_address, defaults.node.external_address); ASSERT_EQ (conf.node.external_port, defaults.node.external_port); @@ -397,7 +396,6 @@ TEST (toml, daemon_config_deserialize_no_defaults) ss << R"toml( [node] - active_elections_size = 999 allow_local_peers = false backup_before_upgrade = true bandwidth_limit = 999 @@ -412,7 +410,6 @@ TEST (toml, daemon_config_deserialize_no_defaults) bootstrap_frontier_request_count = 9999 bootstrap_fraction_numerator = 999 confirming_set_batch_time = 999 - confirmation_history_size = 999 enable_voting = false external_address = "0:0:0:0:0:ffff:7f01:101" external_port = 999 @@ -454,6 +451,13 @@ TEST (toml, daemon_config_deserialize_no_defaults) priority_bootstrap = 999 priority_local = 999 + [node.active_transactions] + size = 999 + hinted_limit_percentage = 90 + optimistic_limit_percentage = 90 + confirmation_history_size = 999 + confirmation_cache = 999 + [node.diagnostics.txn_tracking] enable = true ignore_writes_below_block_processor_max_time = false @@ -603,7 +607,7 @@ TEST (toml, daemon_config_deserialize_no_defaults) ASSERT_NE (conf.rpc.child_process.enable, defaults.rpc.child_process.enable); ASSERT_NE (conf.rpc.child_process.rpc_path, defaults.rpc.child_process.rpc_path); - ASSERT_NE (conf.node.active_elections_size, defaults.node.active_elections_size); + ASSERT_NE (conf.node.active_transactions.size, defaults.node.active_transactions.size); ASSERT_NE (conf.node.allow_local_peers, defaults.node.allow_local_peers); ASSERT_NE (conf.node.backup_before_upgrade, defaults.node.backup_before_upgrade); ASSERT_NE (conf.node.bandwidth_limit, defaults.node.bandwidth_limit); @@ -618,7 +622,6 @@ TEST (toml, daemon_config_deserialize_no_defaults) ASSERT_NE (conf.node.bootstrap_frontier_request_count, defaults.node.bootstrap_frontier_request_count); ASSERT_NE (conf.node.bootstrap_fraction_numerator, defaults.node.bootstrap_fraction_numerator); ASSERT_NE (conf.node.confirming_set_batch_time, defaults.node.confirming_set_batch_time); - ASSERT_NE (conf.node.confirmation_history_size, defaults.node.confirmation_history_size); ASSERT_NE (conf.node.enable_voting, defaults.node.enable_voting); ASSERT_NE (conf.node.external_address, defaults.node.external_address); ASSERT_NE (conf.node.external_port, defaults.node.external_port); @@ -1078,7 +1081,7 @@ TEST (toml, merge_config_files) ss << R"toml( [node] - active_elections_size = 999 + active_transactions.size = 999 # backlog_scan_batch_size = 7777 [node.bootstrap_ascending] block_wait_count = 33333 @@ -1101,8 +1104,8 @@ TEST (toml, merge_config_files) merged_toml.read (ss2); merged_config.deserialize_toml (merged_toml); - ASSERT_NE (merged_config.node.active_elections_size, default_config.node.active_elections_size); - ASSERT_EQ (merged_config.node.active_elections_size, 999); + ASSERT_NE (merged_config.node.active_transactions.size, default_config.node.active_transactions.size); + ASSERT_EQ (merged_config.node.active_transactions.size, 999); ASSERT_NE (merged_config.node.backlog_scan_batch_size, 7777); ASSERT_EQ (merged_config.node.bootstrap_ascending.block_wait_count, 33333); ASSERT_TRUE (merged_config_string.find ("old_entry") == std::string::npos); diff --git a/nano/core_test/voting.cpp b/nano/core_test/voting.cpp index 9a16945468..c0a7d807ef 100644 --- a/nano/core_test/voting.cpp +++ b/nano/core_test/voting.cpp @@ -146,7 +146,7 @@ TEST (vote_spacing, vote_generator) { nano::node_config config; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; - config.active_elections_hinted_limit_percentage = 0; // Disable election hinting + config.active_transactions.hinted_limit_percentage = 0; // Disable election hinting nano::test::system system; nano::node_flags node_flags; node_flags.disable_search_pending = true; @@ -190,7 +190,7 @@ TEST (vote_spacing, rapid) { nano::node_config config; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; - config.active_elections_hinted_limit_percentage = 0; // Disable election hinting + config.active_transactions.hinted_limit_percentage = 0; // Disable election hinting nano::test::system system; nano::node_flags node_flags; node_flags.disable_search_pending = true; diff --git a/nano/nano_node/entry.cpp b/nano/nano_node/entry.cpp index 09190dcfb4..fec6e2d481 100644 --- a/nano/nano_node/entry.cpp +++ b/nano/nano_node/entry.cpp @@ -1238,7 +1238,7 @@ int main (int argc, char * const * argv) else { config2.frontiers_confirmation = daemon_config.node.frontiers_confirmation; - config2.active_elections_size = daemon_config.node.active_elections_size; + config2.active_transactions.size = daemon_config.node.active_transactions.size; } auto node2 (std::make_shared (io_ctx2, path2, config2, work, flags, 1)); diff --git a/nano/node/json_handler.cpp b/nano/node/json_handler.cpp index f220764c86..b2ca6e5279 100644 --- a/nano/node/json_handler.cpp +++ b/nano/node/json_handler.cpp @@ -2039,7 +2039,7 @@ void nano::json_handler::election_statistics () } } - auto utilization_percentage = (static_cast (total_count * 100) / node.config.active_elections_size); + auto utilization_percentage = (static_cast (total_count * 100) / node.config.active_transactions.size); auto max_election_age = std::chrono::duration_cast (now - oldest_election_start).count (); auto average_election_age = total_count ? std::chrono::duration_cast (total_age).count () / total_count : 0; diff --git a/nano/slow_test/node.cpp b/nano/slow_test/node.cpp index a0f02abee1..c6b4c872df 100644 --- a/nano/slow_test/node.cpp +++ b/nano/slow_test/node.cpp @@ -995,7 +995,7 @@ TEST (confirmation_height, many_accounts_send_receive_self) nano::node_config node_config = system.default_config (); node_config.online_weight_minimum = 100; node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; - node_config.active_elections_size = 400000; + node_config.active_transactions.size = 400000; nano::node_flags node_flags; auto node = system.add_node (node_config); system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); From b600e3a75941ca06d0c8ddce47493f366146f851 Mon Sep 17 00:00:00 2001 From: gr0vity-dev Date: Mon, 6 May 2024 13:38:06 +0200 Subject: [PATCH 4/5] formatting --- nano/node/active_transactions.cpp | 1 - nano/node/active_transactions.hpp | 25 +++++++++++-------------- nano/node/nodeconfig.cpp | 4 ++-- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/nano/node/active_transactions.cpp b/nano/node/active_transactions.cpp index dbff6b5b18..9674e38abc 100644 --- a/nano/node/active_transactions.cpp +++ b/nano/node/active_transactions.cpp @@ -766,7 +766,6 @@ std::unique_ptr nano::recently_cemented_cache::c return composite; } - /* * active_transactions_config */ diff --git a/nano/node/active_transactions.hpp b/nano/node/active_transactions.hpp index 2183da1634..6b8f1f326d 100644 --- a/nano/node/active_transactions.hpp +++ b/nano/node/active_transactions.hpp @@ -44,26 +44,23 @@ namespace nano class active_transactions_config final { public: - explicit active_transactions_config (nano::network_constants const &); + explicit active_transactions_config (nano::network_constants const &); - nano::error deserialize (nano::tomlconfig & toml); - nano::error serialize (nano::tomlconfig & toml) const; + nano::error deserialize (nano::tomlconfig & toml); + nano::error serialize (nano::tomlconfig & toml) const; public: - // Maximum number of simultaneous active elections (AEC size) - std::size_t size{ 5000 }; - // Limit of hinted elections as percentage of `active_elections_size` - std::size_t hinted_limit_percentage{ 20 }; - // Limit of optimistic elections as percentage of `active_elections_size` - std::size_t optimistic_limit_percentage{ 10 }; + // Maximum number of simultaneous active elections (AEC size) + std::size_t size{ 5000 }; + // Limit of hinted elections as percentage of `active_elections_size` + std::size_t hinted_limit_percentage{ 20 }; + // Limit of optimistic elections as percentage of `active_elections_size` + std::size_t optimistic_limit_percentage{ 10 }; // Maximum confirmation history size std::size_t confirmation_history_size{ 2048 }; // Maximum cache size for recently_confirmed std::size_t confirmation_cache{ 65536 }; - - - -}; +}; class recently_confirmed_cache final { @@ -234,7 +231,7 @@ class active_transactions final private: // Dependencies active_transactions_config const & config; - nano::node & node; + nano::node & node; nano::confirming_set & confirming_set; nano::block_processor & block_processor; diff --git a/nano/node/nodeconfig.cpp b/nano/node/nodeconfig.cpp index ee5d2c5318..577db2a492 100644 --- a/nano/node/nodeconfig.cpp +++ b/nano/node/nodeconfig.cpp @@ -120,7 +120,7 @@ nano::error nano::node_config::serialize_toml (nano::tomlconfig & toml) const toml.put ("external_port", external_port, "The external port number of this node (NAT). Only used if external_address is set.\ntype:uint16"); toml.put ("tcp_incoming_connections_max", tcp_incoming_connections_max, "Maximum number of incoming TCP connections.\ntype:uint64"); toml.put ("use_memory_pools", use_memory_pools, "If true, allocate memory from memory pools. Enabling this may improve performance. Memory is never released to the OS.\ntype:bool"); - + toml.put ("bandwidth_limit", bandwidth_limit, "Outbound traffic limit in bytes/sec after which messages will be dropped.\nNote: changing to unlimited bandwidth (0) is not recommended for limited connections.\ntype:uint64"); toml.put ("bandwidth_limit_burst_ratio", bandwidth_limit_burst_ratio, "Burst ratio for outbound traffic shaping.\ntype:double"); @@ -468,7 +468,7 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml) toml.get (pow_sleep_interval_key, pow_sleep_interval_l); pow_sleep_interval = std::chrono::nanoseconds (pow_sleep_interval_l); toml.get ("use_memory_pools", use_memory_pools); - + toml.get ("bandwidth_limit", bandwidth_limit); toml.get ("bandwidth_limit_burst_ratio", bandwidth_limit_burst_ratio); From 4a00f05a759ed095d676fe2c930f2501b81a480b Mon Sep 17 00:00:00 2001 From: gr0vity-dev Date: Mon, 6 May 2024 16:11:34 +0200 Subject: [PATCH 5/5] rename class to --- nano/core_test/CMakeLists.txt | 2 +- ..._transactions.cpp => active_elections.cpp} | 60 ++++----- nano/core_test/backlog.cpp | 2 +- nano/core_test/blockprocessor.cpp | 4 +- nano/core_test/bootstrap.cpp | 2 +- nano/core_test/confirmation_solicitor.cpp | 2 +- nano/core_test/confirming_set.cpp | 2 +- nano/core_test/conflicts.cpp | 2 +- nano/core_test/election.cpp | 2 +- nano/core_test/election_scheduler.cpp | 6 +- nano/core_test/frontiers_confirmation.cpp | 2 +- nano/core_test/ledger.cpp | 2 +- nano/core_test/ledger_confirm.cpp | 2 +- nano/core_test/memory_pool.cpp | 2 +- nano/core_test/node.cpp | 2 +- nano/core_test/optimistic_scheduler.cpp | 2 +- nano/core_test/rep_crawler.cpp | 2 +- nano/core_test/request_aggregator.cpp | 2 +- nano/core_test/toml.cpp | 14 +-- nano/core_test/vote_processor.cpp | 2 +- nano/core_test/voting.cpp | 4 +- nano/core_test/wallet.cpp | 2 +- nano/core_test/wallets.cpp | 2 +- nano/core_test/websocket.cpp | 2 +- nano/lib/logging_enums.hpp | 4 +- nano/lib/stats_enums.hpp | 2 +- nano/nano_node/entry.cpp | 4 +- nano/node/CMakeLists.txt | 4 +- ..._transactions.cpp => active_elections.cpp} | 114 +++++++++--------- ..._transactions.hpp => active_elections.hpp} | 24 ++-- nano/node/blockprocessor.cpp | 2 +- nano/node/cli.cpp | 2 +- nano/node/common.cpp | 2 +- nano/node/election.cpp | 2 +- nano/node/election.hpp | 2 +- nano/node/inactive_node.cpp | 2 +- nano/node/json_handler.cpp | 4 +- nano/node/node.cpp | 4 +- nano/node/node.hpp | 6 +- nano/node/nodeconfig.cpp | 18 +-- nano/node/nodeconfig.hpp | 4 +- nano/node/repcrawler.cpp | 2 +- nano/node/repcrawler.hpp | 4 +- nano/node/request_aggregator.cpp | 4 +- nano/node/request_aggregator.hpp | 6 +- nano/node/scheduler/hinted.cpp | 4 +- nano/node/scheduler/hinted.hpp | 6 +- nano/node/scheduler/manual.cpp | 2 +- nano/node/scheduler/optimistic.cpp | 4 +- nano/node/scheduler/optimistic.hpp | 6 +- nano/node/scheduler/priority.cpp | 2 +- nano/node/vote_cache.hpp | 2 +- nano/node/vote_processor.cpp | 4 +- nano/node/vote_processor.hpp | 6 +- nano/rpc_test/rpc.cpp | 2 +- nano/slow_test/node.cpp | 4 +- nano/slow_test/vote_cache.cpp | 2 +- nano/test_common/system.cpp | 2 +- nano/test_common/testutil.cpp | 2 +- 59 files changed, 195 insertions(+), 195 deletions(-) rename nano/core_test/{active_transactions.cpp => active_elections.cpp} (97%) rename nano/node/{active_transactions.cpp => active_elections.cpp} (79%) rename nano/node/{active_transactions.hpp => active_elections.hpp} (93%) diff --git a/nano/core_test/CMakeLists.txt b/nano/core_test/CMakeLists.txt index 430ceee784..b53c4a4deb 100644 --- a/nano/core_test/CMakeLists.txt +++ b/nano/core_test/CMakeLists.txt @@ -3,7 +3,7 @@ add_executable( entry.cpp fakes/websocket_client.hpp fakes/work_peer.hpp - active_transactions.cpp + active_elections.cpp async.cpp backlog.cpp block.cpp diff --git a/nano/core_test/active_transactions.cpp b/nano/core_test/active_elections.cpp similarity index 97% rename from nano/core_test/active_transactions.cpp rename to nano/core_test/active_elections.cpp index 931598d496..627e17cf95 100644 --- a/nano/core_test/active_transactions.cpp +++ b/nano/core_test/active_elections.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include @@ -29,7 +29,7 @@ using namespace std::chrono_literals; * - node2 with: * - disabled rep crawler -> this inhibits node2 from learning that node1 is a rep */ -TEST (active_transactions, confirm_election_by_request) +TEST (active_elections, confirm_election_by_request) { nano::test::system system{}; auto & node1 = *system.add_node (); @@ -99,7 +99,7 @@ TEST (active_transactions, confirm_election_by_request) ASSERT_TIMELY (5s, nano::test::confirmed (node2, { send1 })); } -TEST (active_transactions, confirm_frontier) +TEST (active_elections, confirm_frontier) { nano::test::system system; @@ -156,14 +156,14 @@ TEST (active_transactions, confirm_frontier) ASSERT_GT (election2->confirmation_request_count, 0u); } -TEST (active_transactions, keep_local) +TEST (active_elections, keep_local) { nano::test::system system{}; nano::node_config node_config = system.default_config (); node_config.enable_voting = false; // Bound to 2, won't drop wallet created transactions, but good to test dropping remote - node_config.active_transactions.size = 2; + node_config.active_elections.size = 2; // Disable frontier confirmation to allow the test to finish before node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; @@ -234,7 +234,7 @@ TEST (active_transactions, keep_local) node.process_active (receive3); /// bound elections, should drop after one loop - ASSERT_TIMELY_EQ (5s, node.active.size (), node_config.active_transactions.size); + ASSERT_TIMELY_EQ (5s, node.active.size (), node_config.active_elections.size); // ASSERT_EQ (1, node.scheduler.size ()); } @@ -543,7 +543,7 @@ TEST (inactive_votes_cache, election_start) namespace nano { -TEST (active_transactions, vote_replays) +TEST (active_elections, vote_replays) { nano::test::system system; nano::node_config node_config = system.default_config (); @@ -643,7 +643,7 @@ TEST (active_transactions, vote_replays) } // Tests that blocks are correctly cleared from the duplicate filter for unconfirmed elections -TEST (active_transactions, dropped_cleanup) +TEST (active_elections, dropped_cleanup) { nano::test::system system; nano::node_flags flags; @@ -700,7 +700,7 @@ TEST (active_transactions, dropped_cleanup) ASSERT_FALSE (node.active.active (hash)); } -TEST (active_transactions, republish_winner) +TEST (active_elections, republish_winner) { nano::test::system system; nano::node_config node_config = system.default_config (); @@ -765,7 +765,7 @@ TEST (active_transactions, republish_winner) ASSERT_TIMELY (5s, node2.block_confirmed (fork->hash ())); } -TEST (active_transactions, fork_filter_cleanup) +TEST (active_elections, fork_filter_cleanup) { nano::test::system system{}; @@ -847,7 +847,7 @@ TEST (active_transactions, fork_filter_cleanup) * (9 votes from this batch should survive and replace existing blocks in the election, why not 10?) * Then send winning block and it should replace one of the existing blocks */ -TEST (active_transactions, fork_replacement_tally) +TEST (active_elections, fork_replacement_tally) { nano::test::system system; nano::node_config node_config = system.default_config (); @@ -1004,7 +1004,7 @@ TEST (active_transactions, fork_replacement_tally) namespace nano { // Blocks that won an election must always be seen as confirming or cemented -TEST (active_transactions, confirmation_consistency) +TEST (active_elections, confirmation_consistency) { nano::test::system system; nano::node_config node_config = system.default_config (); @@ -1031,7 +1031,7 @@ TEST (active_transactions, confirmation_consistency) } } -TEST (active_transactions, confirm_new) +TEST (active_elections, confirm_new) { nano::test::system system (1); auto & node1 = *system.nodes[0]; @@ -1056,7 +1056,7 @@ TEST (active_transactions, confirm_new) } // Ensures votes are tallied on election::publish even if no vote is inserted through inactive_votes_cache -TEST (active_transactions, conflicting_block_vote_existing_election) +TEST (active_elections, conflicting_block_vote_existing_election) { nano::test::system system; nano::node_flags node_flags; @@ -1099,7 +1099,7 @@ TEST (active_transactions, conflicting_block_vote_existing_election) ASSERT_TIMELY (3s, election->confirmed ()); } -TEST (active_transactions, activate_account_chain) +TEST (active_elections, activate_account_chain) { nano::test::system system; nano::node_flags flags; @@ -1199,7 +1199,7 @@ TEST (active_transactions, activate_account_chain) ASSERT_TIMELY (3s, node.active.active (receive->qualified_root ())); } -TEST (active_transactions, activate_inactive) +TEST (active_elections, activate_inactive) { nano::test::system system; nano::node_flags flags; @@ -1257,7 +1257,7 @@ TEST (active_transactions, activate_inactive) ASSERT_FALSE (node.active.active (open->qualified_root ()) || node.block_confirmed_or_being_confirmed (open->hash ())); } -TEST (active_transactions, list_active) +TEST (active_elections, list_active) { nano::test::system system (1); auto & node = *system.nodes[0]; @@ -1312,13 +1312,13 @@ TEST (active_transactions, list_active) auto active = node.active.list_active (); } -TEST (active_transactions, vacancy) +TEST (active_elections, vacancy) { std::atomic updated = false; { nano::test::system system; nano::node_config config = system.default_config (); - config.active_transactions.size = 1; + config.active_elections.size = 1; auto & node = *system.add_node (config); nano::state_block_builder builder; auto send = builder.make_block () @@ -1349,12 +1349,12 @@ TEST (active_transactions, vacancy) } // Ensure transactions in excess of capacity are removed in fifo order -TEST (active_transactions, fifo) +TEST (active_elections, fifo) { nano::test::system system{}; nano::node_config config = system.default_config (); - config.active_transactions.size = 1; + config.active_elections.size = 1; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; auto & node = *system.add_node (config); @@ -1434,15 +1434,15 @@ TEST (active_transactions, fifo) /* * Ensures we limit the number of vote hinted elections in AEC */ -TEST (active_transactions, limit_vote_hinted_elections) +TEST (active_elections, limit_vote_hinted_elections) { nano::test::system system; nano::node_config config = system.default_config (); const int aec_limit = 10; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; config.optimistic_scheduler.enabled = false; - config.active_transactions.size = aec_limit; - config.active_transactions.hinted_limit_percentage = 10; // Should give us a limit of 1 hinted election + config.active_elections.size = aec_limit; + config.active_elections.hinted_limit_percentage = 10; // Should give us a limit of 1 hinted election auto & node = *system.add_node (config); // Setup representatives @@ -1500,14 +1500,14 @@ TEST (active_transactions, limit_vote_hinted_elections) /* * Tests that when AEC is running at capacity from normal elections, it is still possible to schedule a limited number of hinted elections */ -TEST (active_transactions, allow_limited_overflow) +TEST (active_elections, allow_limited_overflow) { nano::test::system system; nano::node_config config = system.default_config (); const int aec_limit = 20; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; - config.active_transactions.size = aec_limit; - config.active_transactions.hinted_limit_percentage = 20; // Should give us a limit of 4 hinted elections + config.active_elections.size = aec_limit; + config.active_elections.hinted_limit_percentage = 20; // Should give us a limit of 4 hinted elections auto & node = *system.add_node (config); auto blocks = nano::test::setup_independent_blocks (system, node, aec_limit * 4); @@ -1549,14 +1549,14 @@ TEST (active_transactions, allow_limited_overflow) /* * Tests that when hinted elections are present in the AEC, normal scheduler adapts not to exceed the limit of all elections */ -TEST (active_transactions, allow_limited_overflow_adapt) +TEST (active_elections, allow_limited_overflow_adapt) { nano::test::system system; nano::node_config config = system.default_config (); const int aec_limit = 20; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; - config.active_transactions.size = aec_limit; - config.active_transactions.hinted_limit_percentage = 20; // Should give us a limit of 4 hinted elections + config.active_elections.size = aec_limit; + config.active_elections.hinted_limit_percentage = 20; // Should give us a limit of 4 hinted elections auto & node = *system.add_node (config); auto blocks = nano::test::setup_independent_blocks (system, node, aec_limit * 4); diff --git a/nano/core_test/backlog.cpp b/nano/core_test/backlog.cpp index f13c16f1c5..543547b1a1 100644 --- a/nano/core_test/backlog.cpp +++ b/nano/core_test/backlog.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/nano/core_test/blockprocessor.cpp b/nano/core_test/blockprocessor.cpp index 3050947d3f..57c777062b 100644 --- a/nano/core_test/blockprocessor.cpp +++ b/nano/core_test/blockprocessor.cpp @@ -16,9 +16,9 @@ TEST (block_processor, broadcast_block_on_arrival) nano::test::system system; nano::node_config config1 = system.default_config (); // Deactivates elections on both nodes. - config1.active_transactions.size = 0; + config1.active_elections.size = 0; nano::node_config config2 = system.default_config (); - config2.active_transactions.size = 0; + config2.active_elections.size = 0; nano::node_flags flags; // Disables bootstrap listener to make sure the block won't be shared by this channel. flags.disable_bootstrap_listener = true; diff --git a/nano/core_test/bootstrap.cpp b/nano/core_test/bootstrap.cpp index 84995fa540..bd1e5571c8 100644 --- a/nano/core_test/bootstrap.cpp +++ b/nano/core_test/bootstrap.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/nano/core_test/confirmation_solicitor.cpp b/nano/core_test/confirmation_solicitor.cpp index 20e2ee5af5..f3609a36a6 100644 --- a/nano/core_test/confirmation_solicitor.cpp +++ b/nano/core_test/confirmation_solicitor.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/nano/core_test/confirming_set.cpp b/nano/core_test/confirming_set.cpp index efb0f91abf..0a699182d1 100644 --- a/nano/core_test/confirming_set.cpp +++ b/nano/core_test/confirming_set.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/nano/core_test/conflicts.cpp b/nano/core_test/conflicts.cpp index cbf1a9e866..8a4ca3a481 100644 --- a/nano/core_test/conflicts.cpp +++ b/nano/core_test/conflicts.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/nano/core_test/election.cpp b/nano/core_test/election.cpp index ac80c52885..eb5aafe08e 100644 --- a/nano/core_test/election.cpp +++ b/nano/core_test/election.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/nano/core_test/election_scheduler.cpp b/nano/core_test/election_scheduler.cpp index 7abd60aa15..02a37bec89 100644 --- a/nano/core_test/election_scheduler.cpp +++ b/nano/core_test/election_scheduler.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -56,7 +56,7 @@ TEST (election_scheduler, activate_one_flush) /** * Tests that the election scheduler and the active transactions container (AEC) - * work in sync with regards to the node configuration value "active_transactions.size". + * work in sync with regards to the node configuration value "active_elections.size". * * The test sets up two forcefully cemented blocks -- a send on the genesis account and a receive on a second account. * It then creates two other blocks, each a successor to one of the previous two, @@ -74,7 +74,7 @@ TEST (election_scheduler, no_vacancy) nano::test::system system{}; nano::node_config config = system.default_config (); - config.active_transactions.size = 1; + config.active_elections.size = 1; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; auto & node = *system.add_node (config); diff --git a/nano/core_test/frontiers_confirmation.cpp b/nano/core_test/frontiers_confirmation.cpp index b8c521b678..89c19752b9 100644 --- a/nano/core_test/frontiers_confirmation.cpp +++ b/nano/core_test/frontiers_confirmation.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/nano/core_test/ledger.cpp b/nano/core_test/ledger.cpp index dbfabf86be..46b03eac70 100644 --- a/nano/core_test/ledger.cpp +++ b/nano/core_test/ledger.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/nano/core_test/ledger_confirm.cpp b/nano/core_test/ledger_confirm.cpp index dcda5ac0b7..5729369a06 100644 --- a/nano/core_test/ledger_confirm.cpp +++ b/nano/core_test/ledger_confirm.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/nano/core_test/memory_pool.cpp b/nano/core_test/memory_pool.cpp index 1d9c1fc1b8..6d5dd4ae90 100644 --- a/nano/core_test/memory_pool.cpp +++ b/nano/core_test/memory_pool.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/nano/core_test/node.cpp b/nano/core_test/node.cpp index da56b816d8..d7d24d11ac 100644 --- a/nano/core_test/node.cpp +++ b/nano/core_test/node.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/nano/core_test/optimistic_scheduler.cpp b/nano/core_test/optimistic_scheduler.cpp index 1fc1deac86..c7f7311c8d 100644 --- a/nano/core_test/optimistic_scheduler.cpp +++ b/nano/core_test/optimistic_scheduler.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/nano/core_test/rep_crawler.cpp b/nano/core_test/rep_crawler.cpp index 13088d7d76..e775c2338e 100644 --- a/nano/core_test/rep_crawler.cpp +++ b/nano/core_test/rep_crawler.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/nano/core_test/request_aggregator.cpp b/nano/core_test/request_aggregator.cpp index 942e26b4b6..e78bc2a5ac 100644 --- a/nano/core_test/request_aggregator.cpp +++ b/nano/core_test/request_aggregator.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/nano/core_test/toml.cpp b/nano/core_test/toml.cpp index dc1ed2fa44..fdf3370aa6 100644 --- a/nano/core_test/toml.cpp +++ b/nano/core_test/toml.cpp @@ -152,7 +152,7 @@ TEST (toml, daemon_config_deserialize_defaults) ASSERT_EQ (conf.rpc.child_process.enable, defaults.rpc.child_process.enable); ASSERT_EQ (conf.rpc.child_process.rpc_path, defaults.rpc.child_process.rpc_path); - ASSERT_EQ (conf.node.active_transactions.size, defaults.node.active_transactions.size); + ASSERT_EQ (conf.node.active_elections.size, defaults.node.active_elections.size); ASSERT_EQ (conf.node.allow_local_peers, defaults.node.allow_local_peers); ASSERT_EQ (conf.node.backup_before_upgrade, defaults.node.backup_before_upgrade); ASSERT_EQ (conf.node.bandwidth_limit, defaults.node.bandwidth_limit); @@ -451,7 +451,7 @@ TEST (toml, daemon_config_deserialize_no_defaults) priority_bootstrap = 999 priority_local = 999 - [node.active_transactions] + [node.active_elections] size = 999 hinted_limit_percentage = 90 optimistic_limit_percentage = 90 @@ -607,7 +607,7 @@ TEST (toml, daemon_config_deserialize_no_defaults) ASSERT_NE (conf.rpc.child_process.enable, defaults.rpc.child_process.enable); ASSERT_NE (conf.rpc.child_process.rpc_path, defaults.rpc.child_process.rpc_path); - ASSERT_NE (conf.node.active_transactions.size, defaults.node.active_transactions.size); + ASSERT_NE (conf.node.active_elections.size, defaults.node.active_elections.size); ASSERT_NE (conf.node.allow_local_peers, defaults.node.allow_local_peers); ASSERT_NE (conf.node.backup_before_upgrade, defaults.node.backup_before_upgrade); ASSERT_NE (conf.node.bandwidth_limit, defaults.node.bandwidth_limit); @@ -1024,7 +1024,7 @@ TEST (toml, log_config_no_defaults) rotation_count = 999 [log.levels] - active_transactions = "trace" + active_elections = "trace" blockprocessor = "trace" )toml"; @@ -1081,7 +1081,7 @@ TEST (toml, merge_config_files) ss << R"toml( [node] - active_transactions.size = 999 + active_elections.size = 999 # backlog_scan_batch_size = 7777 [node.bootstrap_ascending] block_wait_count = 33333 @@ -1104,8 +1104,8 @@ TEST (toml, merge_config_files) merged_toml.read (ss2); merged_config.deserialize_toml (merged_toml); - ASSERT_NE (merged_config.node.active_transactions.size, default_config.node.active_transactions.size); - ASSERT_EQ (merged_config.node.active_transactions.size, 999); + ASSERT_NE (merged_config.node.active_elections.size, default_config.node.active_elections.size); + ASSERT_EQ (merged_config.node.active_elections.size, 999); ASSERT_NE (merged_config.node.backlog_scan_batch_size, 7777); ASSERT_EQ (merged_config.node.bootstrap_ascending.block_wait_count, 33333); ASSERT_TRUE (merged_config_string.find ("old_entry") == std::string::npos); diff --git a/nano/core_test/vote_processor.cpp b/nano/core_test/vote_processor.cpp index 9e0214c094..a7986d3343 100644 --- a/nano/core_test/vote_processor.cpp +++ b/nano/core_test/vote_processor.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/nano/core_test/voting.cpp b/nano/core_test/voting.cpp index c0a7d807ef..458eb54d34 100644 --- a/nano/core_test/voting.cpp +++ b/nano/core_test/voting.cpp @@ -146,7 +146,7 @@ TEST (vote_spacing, vote_generator) { nano::node_config config; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; - config.active_transactions.hinted_limit_percentage = 0; // Disable election hinting + config.active_elections.hinted_limit_percentage = 0; // Disable election hinting nano::test::system system; nano::node_flags node_flags; node_flags.disable_search_pending = true; @@ -190,7 +190,7 @@ TEST (vote_spacing, rapid) { nano::node_config config; config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; - config.active_transactions.hinted_limit_percentage = 0; // Disable election hinting + config.active_elections.hinted_limit_percentage = 0; // Disable election hinting nano::test::system system; nano::node_flags node_flags; node_flags.disable_search_pending = true; diff --git a/nano/core_test/wallet.cpp b/nano/core_test/wallet.cpp index faa6adbe97..204b7b1471 100644 --- a/nano/core_test/wallet.cpp +++ b/nano/core_test/wallet.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/nano/core_test/wallets.cpp b/nano/core_test/wallets.cpp index 965c496925..d87e38b788 100644 --- a/nano/core_test/wallets.cpp +++ b/nano/core_test/wallets.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/nano/core_test/websocket.cpp b/nano/core_test/websocket.cpp index beabcad4a8..91ae598b95 100644 --- a/nano/core_test/websocket.cpp +++ b/nano/core_test/websocket.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/nano/lib/logging_enums.hpp b/nano/lib/logging_enums.hpp index 4e434b4cc3..662981d0a6 100644 --- a/nano/lib/logging_enums.hpp +++ b/nano/lib/logging_enums.hpp @@ -45,7 +45,7 @@ enum class type ipc_server, websocket, tls, - active_transactions, + active_elections, election, blockprocessor, network, @@ -104,7 +104,7 @@ enum class detail // node process_confirmed, - // active_transactions + // active_elections active_started, active_stopped, diff --git a/nano/lib/stats_enums.hpp b/nano/lib/stats_enums.hpp index be36061e30..81f121fc1c 100644 --- a/nano/lib/stats_enums.hpp +++ b/nano/lib/stats_enums.hpp @@ -55,7 +55,7 @@ enum class type bootstrap_server_overfill, bootstrap_server_response, active, - active_transactions, + active_elections, active_started, active_confirmed, active_dropped, diff --git a/nano/nano_node/entry.cpp b/nano/nano_node/entry.cpp index fec6e2d481..dc603cfb8e 100644 --- a/nano/nano_node/entry.cpp +++ b/nano/nano_node/entry.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -1238,7 +1238,7 @@ int main (int argc, char * const * argv) else { config2.frontiers_confirmation = daemon_config.node.frontiers_confirmation; - config2.active_transactions.size = daemon_config.node.active_transactions.size; + config2.active_elections.size = daemon_config.node.active_elections.size; } auto node2 (std::make_shared (io_ctx2, path2, config2, work, flags, 1)); diff --git a/nano/node/CMakeLists.txt b/nano/node/CMakeLists.txt index ec525aa955..d392f82284 100644 --- a/nano/node/CMakeLists.txt +++ b/nano/node/CMakeLists.txt @@ -14,8 +14,8 @@ endif() add_library( node ${platform_sources} - active_transactions.hpp - active_transactions.cpp + active_elections.hpp + active_elections.cpp backlog_population.hpp backlog_population.cpp bandwidth_limiter.hpp diff --git a/nano/node/active_transactions.cpp b/nano/node/active_elections.cpp similarity index 79% rename from nano/node/active_transactions.cpp rename to nano/node/active_elections.cpp index 9674e38abc..8be7dc3c18 100644 --- a/nano/node/active_transactions.cpp +++ b/nano/node/active_elections.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include @@ -17,8 +17,8 @@ using namespace std::chrono; -nano::active_transactions::active_transactions (nano::node & node_a, nano::confirming_set & confirming_set, nano::block_processor & block_processor_a) : - config{ node_a.config.active_transactions }, +nano::active_elections::active_elections (nano::node & node_a, nano::confirming_set & confirming_set, nano::block_processor & block_processor_a) : + config{ node_a.config.active_elections }, node{ node_a }, confirming_set{ confirming_set }, block_processor{ block_processor_a }, @@ -51,13 +51,13 @@ nano::active_transactions::active_transactions (nano::node & node_a, nano::confi }); } -nano::active_transactions::~active_transactions () +nano::active_elections::~active_elections () { // Thread must be stopped before destruction debug_assert (!thread.joinable ()); } -void nano::active_transactions::start () +void nano::active_elections::start () { if (node.flags.disable_request_loop) { @@ -72,7 +72,7 @@ void nano::active_transactions::start () }); } -void nano::active_transactions::stop () +void nano::active_elections::stop () { { nano::lock_guard guard{ mutex }; @@ -83,7 +83,7 @@ void nano::active_transactions::stop () clear (); } -void nano::active_transactions::block_cemented_callback (std::shared_ptr const & block) +void nano::active_elections::block_cemented_callback (std::shared_ptr const & block) { debug_assert (node.block_confirmed (block->hash ())); if (auto election_l = election (block->qualified_root ())) @@ -124,7 +124,7 @@ void nano::active_transactions::block_cemented_callback (std::shared_ptr const & votes) +void nano::active_elections::notify_observers (nano::secure::read_transaction const & transaction, nano::election_status const & status, std::vector const & votes) { auto block = status.winner; auto account = block->account (); @@ -143,7 +143,7 @@ void nano::active_transactions::notify_observers (nano::secure::read_transaction } } -void nano::active_transactions::activate_successors (nano::secure::read_transaction const & transaction, std::shared_ptr const & block) +void nano::active_elections::activate_successors (nano::secure::read_transaction const & transaction, std::shared_ptr const & block) { node.scheduler.priority.activate (transaction, block->account ()); @@ -154,13 +154,13 @@ void nano::active_transactions::activate_successors (nano::secure::read_transact } } -void nano::active_transactions::add_election_winner_details (nano::block_hash const & hash_a, std::shared_ptr const & election_a) +void nano::active_elections::add_election_winner_details (nano::block_hash const & hash_a, std::shared_ptr const & election_a) { nano::lock_guard guard{ election_winner_details_mutex }; election_winner_details.emplace (hash_a, election_a); } -std::shared_ptr nano::active_transactions::remove_election_winner_details (nano::block_hash const & hash_a) +std::shared_ptr nano::active_elections::remove_election_winner_details (nano::block_hash const & hash_a) { nano::lock_guard guard{ election_winner_details_mutex }; std::shared_ptr result; @@ -173,7 +173,7 @@ std::shared_ptr nano::active_transactions::remove_election_winne return result; } -void nano::active_transactions::block_already_cemented_callback (nano::block_hash const & hash_a) +void nano::active_elections::block_already_cemented_callback (nano::block_hash const & hash_a) { // Depending on timing there is a situation where the election_winner_details is not reset. // This can happen when a block wins an election, and the block is confirmed + observer @@ -182,7 +182,7 @@ void nano::active_transactions::block_already_cemented_callback (nano::block_has remove_election_winner_details (hash_a); } -int64_t nano::active_transactions::limit (nano::election_behavior behavior) const +int64_t nano::active_elections::limit (nano::election_behavior behavior) const { switch (behavior) { @@ -206,7 +206,7 @@ int64_t nano::active_transactions::limit (nano::election_behavior behavior) cons return 0; } -int64_t nano::active_transactions::vacancy (nano::election_behavior behavior) const +int64_t nano::active_elections::vacancy (nano::election_behavior behavior) const { nano::lock_guard guard{ mutex }; switch (behavior) @@ -221,7 +221,7 @@ int64_t nano::active_transactions::vacancy (nano::election_behavior behavior) co return 0; } -void nano::active_transactions::request_confirm (nano::unique_lock & lock_a) +void nano::active_elections::request_confirm (nano::unique_lock & lock_a) { debug_assert (lock_a.owns_lock ()); @@ -258,7 +258,7 @@ void nano::active_transactions::request_confirm (nano::unique_lock lock_a.lock (); } -void nano::active_transactions::cleanup_election (nano::unique_lock & lock_a, std::shared_ptr election) +void nano::active_elections::cleanup_election (nano::unique_lock & lock_a, std::shared_ptr election) { debug_assert (!mutex.try_lock ()); debug_assert (lock_a.owns_lock ()); @@ -279,9 +279,9 @@ void nano::active_transactions::cleanup_election (nano::unique_lock roots.get ().erase (roots.get ().find (election->qualified_root)); node.stats.inc (completion_type (*election), to_stat_detail (election->behavior ())); - node.logger.trace (nano::log::type::active_transactions, nano::log::detail::active_stopped, nano::log::arg{ "election", election }); + node.logger.trace (nano::log::type::active_elections, nano::log::detail::active_stopped, nano::log::arg{ "election", election }); - node.logger.debug (nano::log::type::active_transactions, "Erased election for blocks: {} (behavior: {}, state: {})", + node.logger.debug (nano::log::type::active_elections, "Erased election for blocks: {} (behavior: {}, state: {})", fmt::join (std::views::keys (blocks_l), ", "), to_string (election->behavior ()), to_string (election->state ())); @@ -308,7 +308,7 @@ void nano::active_transactions::cleanup_election (nano::unique_lock } } -nano::stat::type nano::active_transactions::completion_type (nano::election const & election) const +nano::stat::type nano::active_elections::completion_type (nano::election const & election) const { if (election.confirmed ()) { @@ -321,13 +321,13 @@ nano::stat::type nano::active_transactions::completion_type (nano::election cons return nano::stat::type::active_dropped; } -std::vector> nano::active_transactions::list_active (std::size_t max_a) +std::vector> nano::active_elections::list_active (std::size_t max_a) { nano::lock_guard guard{ mutex }; return list_active_impl (max_a); } -std::vector> nano::active_transactions::list_active_impl (std::size_t max_a) const +std::vector> nano::active_elections::list_active_impl (std::size_t max_a) const { std::vector> result_l; result_l.reserve (std::min (max_a, roots.size ())); @@ -342,7 +342,7 @@ std::vector> nano::active_transactions::list_act return result_l; } -void nano::active_transactions::request_loop () +void nano::active_elections::request_loop () { nano::unique_lock lock{ mutex }; while (!stopped) @@ -363,7 +363,7 @@ void nano::active_transactions::request_loop () } } -void nano::active_transactions::trim () +void nano::active_elections::trim () { /* * Both normal and hinted election schedulers are well-behaved, meaning they first check for AEC vacancy before inserting new elections. @@ -377,7 +377,7 @@ void nano::active_transactions::trim () } } -nano::election_insertion_result nano::active_transactions::insert (std::shared_ptr const & block_a, nano::election_behavior election_behavior_a) +nano::election_insertion_result nano::active_elections::insert (std::shared_ptr const & block_a, nano::election_behavior election_behavior_a) { debug_assert (block_a); debug_assert (block_a->has_sideband ()); @@ -404,7 +404,7 @@ nano::election_insertion_result nano::active_transactions::insert (std::shared_p node.online_reps.observe (rep_a); }; result.election = nano::make_shared (node, block_a, nullptr, observe_rep_cb, election_behavior_a); - roots.get ().emplace (nano::active_transactions::conflict_info{ root, result.election }); + roots.get ().emplace (nano::active_elections::conflict_info{ root, result.election }); blocks.emplace (hash, result.election); // Keep track of election count by election type @@ -412,11 +412,11 @@ nano::election_insertion_result nano::active_transactions::insert (std::shared_p count_by_behavior[result.election->behavior ()]++; node.stats.inc (nano::stat::type::active_started, to_stat_detail (election_behavior_a)); - node.logger.trace (nano::log::type::active_transactions, nano::log::detail::active_started, + node.logger.trace (nano::log::type::active_elections, nano::log::detail::active_started, nano::log::arg{ "behavior", election_behavior_a }, nano::log::arg{ "election", result.election }); - node.logger.debug (nano::log::type::active_transactions, "Started new election for block: {} (behavior: {})", + node.logger.debug (nano::log::type::active_elections, "Started new election for block: {} (behavior: {})", hash.to_string (), to_string (election_behavior_a)); } @@ -453,7 +453,7 @@ nano::election_insertion_result nano::active_transactions::insert (std::shared_p return result; } -bool nano::active_transactions::trigger_vote_cache (nano::block_hash hash) +bool nano::active_elections::trigger_vote_cache (nano::block_hash hash) { auto cached = node.vote_cache.find (hash); for (auto const & cached_vote : cached) @@ -464,7 +464,7 @@ bool nano::active_transactions::trigger_vote_cache (nano::block_hash hash) } // Validate a vote and apply it to the current election if one exists -std::unordered_map nano::active_transactions::vote (std::shared_ptr const & vote, nano::vote_source source) +std::unordered_map nano::active_elections::vote (std::shared_ptr const & vote, nano::vote_source source) { debug_assert (!vote->validate ()); // false => valid vote @@ -513,25 +513,25 @@ std::unordered_map nano::active_transactions: return results; } -bool nano::active_transactions::active (nano::qualified_root const & root_a) const +bool nano::active_elections::active (nano::qualified_root const & root_a) const { nano::lock_guard lock{ mutex }; return roots.get ().find (root_a) != roots.get ().end (); } -bool nano::active_transactions::active (nano::block const & block_a) const +bool nano::active_elections::active (nano::block const & block_a) const { nano::lock_guard guard{ mutex }; return roots.get ().find (block_a.qualified_root ()) != roots.get ().end () && blocks.find (block_a.hash ()) != blocks.end (); } -bool nano::active_transactions::active (const nano::block_hash & hash) const +bool nano::active_elections::active (const nano::block_hash & hash) const { nano::lock_guard guard{ mutex }; return blocks.find (hash) != blocks.end (); } -std::shared_ptr nano::active_transactions::election (nano::qualified_root const & root_a) const +std::shared_ptr nano::active_elections::election (nano::qualified_root const & root_a) const { std::shared_ptr result; nano::lock_guard lock{ mutex }; @@ -543,7 +543,7 @@ std::shared_ptr nano::active_transactions::election (nano::quali return result; } -std::shared_ptr nano::active_transactions::winner (nano::block_hash const & hash_a) const +std::shared_ptr nano::active_elections::winner (nano::block_hash const & hash_a) const { std::shared_ptr result; nano::unique_lock lock{ mutex }; @@ -557,12 +557,12 @@ std::shared_ptr nano::active_transactions::winner (nano::block_hash return result; } -bool nano::active_transactions::erase (nano::block const & block_a) +bool nano::active_elections::erase (nano::block const & block_a) { return erase (block_a.qualified_root ()); } -bool nano::active_transactions::erase (nano::qualified_root const & root_a) +bool nano::active_elections::erase (nano::qualified_root const & root_a) { nano::unique_lock lock{ mutex }; auto root_it (roots.get ().find (root_a)); @@ -574,7 +574,7 @@ bool nano::active_transactions::erase (nano::qualified_root const & root_a) return false; } -bool nano::active_transactions::erase_hash (nano::block_hash const & hash_a) +bool nano::active_elections::erase_hash (nano::block_hash const & hash_a) { nano::unique_lock lock{ mutex }; [[maybe_unused]] auto erased (blocks.erase (hash_a)); @@ -582,7 +582,7 @@ bool nano::active_transactions::erase_hash (nano::block_hash const & hash_a) return erased == 1; } -void nano::active_transactions::erase_oldest () +void nano::active_elections::erase_oldest () { nano::unique_lock lock{ mutex }; if (!roots.empty ()) @@ -592,19 +592,19 @@ void nano::active_transactions::erase_oldest () } } -bool nano::active_transactions::empty () const +bool nano::active_elections::empty () const { nano::lock_guard lock{ mutex }; return roots.empty (); } -std::size_t nano::active_transactions::size () const +std::size_t nano::active_elections::size () const { nano::lock_guard lock{ mutex }; return roots.size (); } -bool nano::active_transactions::publish (std::shared_ptr const & block_a) +bool nano::active_elections::publish (std::shared_ptr const & block_a) { nano::unique_lock lock{ mutex }; auto existing (roots.get ().find (block_a->qualified_root ())); @@ -628,13 +628,13 @@ bool nano::active_transactions::publish (std::shared_ptr const & bl return result; } -std::size_t nano::active_transactions::election_winner_details_size () +std::size_t nano::active_elections::election_winner_details_size () { nano::lock_guard guard{ election_winner_details_mutex }; return election_winner_details.size (); } -void nano::active_transactions::clear () +void nano::active_elections::clear () { { nano::lock_guard guard{ mutex }; @@ -644,20 +644,20 @@ void nano::active_transactions::clear () vacancy_update (); } -std::unique_ptr nano::collect_container_info (active_transactions & active_transactions, std::string const & name) +std::unique_ptr nano::collect_container_info (active_elections & active_elections, std::string const & name) { - nano::lock_guard guard{ active_transactions.mutex }; + nano::lock_guard guard{ active_elections.mutex }; auto composite = std::make_unique (name); - composite->add_component (std::make_unique (container_info{ "roots", active_transactions.roots.size (), sizeof (decltype (active_transactions.roots)::value_type) })); - composite->add_component (std::make_unique (container_info{ "blocks", active_transactions.blocks.size (), sizeof (decltype (active_transactions.blocks)::value_type) })); - composite->add_component (std::make_unique (container_info{ "election_winner_details", active_transactions.election_winner_details_size (), sizeof (decltype (active_transactions.election_winner_details)::value_type) })); - composite->add_component (std::make_unique (container_info{ "normal", static_cast (active_transactions.count_by_behavior[nano::election_behavior::normal]), 0 })); - composite->add_component (std::make_unique (container_info{ "hinted", static_cast (active_transactions.count_by_behavior[nano::election_behavior::hinted]), 0 })); - composite->add_component (std::make_unique (container_info{ "optimistic", static_cast (active_transactions.count_by_behavior[nano::election_behavior::optimistic]), 0 })); + composite->add_component (std::make_unique (container_info{ "roots", active_elections.roots.size (), sizeof (decltype (active_elections.roots)::value_type) })); + composite->add_component (std::make_unique (container_info{ "blocks", active_elections.blocks.size (), sizeof (decltype (active_elections.blocks)::value_type) })); + composite->add_component (std::make_unique (container_info{ "election_winner_details", active_elections.election_winner_details_size (), sizeof (decltype (active_elections.election_winner_details)::value_type) })); + composite->add_component (std::make_unique (container_info{ "normal", static_cast (active_elections.count_by_behavior[nano::election_behavior::normal]), 0 })); + composite->add_component (std::make_unique (container_info{ "hinted", static_cast (active_elections.count_by_behavior[nano::election_behavior::hinted]), 0 })); + composite->add_component (std::make_unique (container_info{ "optimistic", static_cast (active_elections.count_by_behavior[nano::election_behavior::optimistic]), 0 })); - composite->add_component (active_transactions.recently_confirmed.collect_container_info ("recently_confirmed")); - composite->add_component (active_transactions.recently_cemented.collect_container_info ("recently_cemented")); + composite->add_component (active_elections.recently_confirmed.collect_container_info ("recently_confirmed")); + composite->add_component (active_elections.recently_cemented.collect_container_info ("recently_cemented")); return composite; } @@ -767,14 +767,14 @@ std::unique_ptr nano::recently_cemented_cache::c } /* - * active_transactions_config + * active_elections_config */ -nano::active_transactions_config::active_transactions_config (const nano::network_constants & network_constants) +nano::active_elections_config::active_elections_config (const nano::network_constants & network_constants) { } -nano::error nano::active_transactions_config::serialize (nano::tomlconfig & toml) const +nano::error nano::active_elections_config::serialize (nano::tomlconfig & toml) const { toml.put ("size", size, "Number of active elections. Elections beyond this limit have limited survival time.\nWarning: modifying this value may result in a lower confirmation rate. \ntype:uint64,[250..]"); toml.put ("hinted_limit_percentage", hinted_limit_percentage, "Limit of hinted elections as percentage of `active_elections_size` \ntype:uint64"); @@ -785,7 +785,7 @@ nano::error nano::active_transactions_config::serialize (nano::tomlconfig & toml return toml.get_error (); } -nano::error nano::active_transactions_config::deserialize (nano::tomlconfig & toml) +nano::error nano::active_elections_config::deserialize (nano::tomlconfig & toml) { toml.get ("size", size); toml.get ("hinted_limit_percentage", hinted_limit_percentage); diff --git a/nano/node/active_transactions.hpp b/nano/node/active_elections.hpp similarity index 93% rename from nano/node/active_transactions.hpp rename to nano/node/active_elections.hpp index 6b8f1f326d..9ebff5365f 100644 --- a/nano/node/active_transactions.hpp +++ b/nano/node/active_elections.hpp @@ -25,7 +25,7 @@ namespace mi = boost::multi_index; namespace nano { class node; -class active_transactions; +class active_elections; class block; class block_sideband; class block_processor; @@ -41,10 +41,10 @@ class read_transaction; namespace nano { -class active_transactions_config final +class active_elections_config final { public: - explicit active_transactions_config (nano::network_constants const &); + explicit active_elections_config (nano::network_constants const &); nano::error deserialize (nano::tomlconfig & toml); nano::error serialize (nano::tomlconfig & toml) const; @@ -132,7 +132,7 @@ class recently_cemented_cache final * Core class for determining consensus * Holds all active blocks i.e. recently added blocks that need confirmation */ -class active_transactions final +class active_elections final { private: // Elections class conflict_info final @@ -163,8 +163,8 @@ class active_transactions final std::unordered_map> blocks; public: - active_transactions (nano::node &, nano::confirming_set &, nano::block_processor &); - ~active_transactions (); + active_elections (nano::node &, nano::confirming_set &, nano::block_processor &); + ~active_elections (); void start (); void stop (); @@ -230,7 +230,7 @@ class active_transactions final bool trigger_vote_cache (nano::block_hash); private: // Dependencies - active_transactions_config const & config; + active_elections_config const & config; nano::node & node; nano::confirming_set & confirming_set; nano::block_processor & block_processor; @@ -258,7 +258,7 @@ class active_transactions final std::thread thread; friend class election; - friend std::unique_ptr collect_container_info (active_transactions &, std::string const &); + friend std::unique_ptr collect_container_info (active_elections &, std::string const &); public: // Tests void clear (); @@ -266,15 +266,15 @@ class active_transactions final friend class node_fork_storm_Test; friend class system_block_sequence_Test; friend class node_mass_block_new_Test; - friend class active_transactions_vote_replays_Test; + friend class active_elections_vote_replays_Test; friend class frontiers_confirmation_prioritize_frontiers_Test; friend class frontiers_confirmation_prioritize_frontiers_max_optimistic_elections_Test; friend class confirmation_height_prioritize_frontiers_overwrite_Test; - friend class active_transactions_confirmation_consistency_Test; + friend class active_elections_confirmation_consistency_Test; friend class node_deferred_dependent_elections_Test; - friend class active_transactions_pessimistic_elections_Test; + friend class active_elections_pessimistic_elections_Test; friend class frontiers_confirmation_expired_optimistic_elections_removal_Test; }; -std::unique_ptr collect_container_info (active_transactions & active_transactions, std::string const & name); +std::unique_ptr collect_container_info (active_elections & active_elections, std::string const & name); } diff --git a/nano/node/blockprocessor.cpp b/nano/node/blockprocessor.cpp index c5ec31dca7..80ecefeb62 100644 --- a/nano/node/blockprocessor.cpp +++ b/nano/node/blockprocessor.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/nano/node/cli.cpp b/nano/node/cli.cpp index 55e4da5d3d..87d26b86c8 100644 --- a/nano/node/cli.cpp +++ b/nano/node/cli.cpp @@ -93,7 +93,7 @@ void nano::add_node_flag_options (boost::program_options::options_description & // clang-format off description_a.add_options() ("disable_add_initial_peers", "Disable contacting the peer in the peers table at startup") - ("disable_activate_successors", "Disables activate_successors in active_transactions") + ("disable_activate_successors", "Disables activate_successors in active_elections") ("disable_backup", "Disable wallet automatic backups") ("disable_lazy_bootstrap", "Disables lazy bootstrap") ("disable_legacy_bootstrap", "Disables legacy bootstrap") diff --git a/nano/node/common.cpp b/nano/node/common.cpp index 9a4de71724..5edab1f7f9 100644 --- a/nano/node/common.cpp +++ b/nano/node/common.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/nano/node/election.cpp b/nano/node/election.cpp index e588352a2f..14984826b4 100644 --- a/nano/node/election.cpp +++ b/nano/node/election.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/nano/node/election.hpp b/nano/node/election.hpp index d36e0a38b7..4033eb7acc 100644 --- a/nano/node/election.hpp +++ b/nano/node/election.hpp @@ -181,7 +181,7 @@ class election final : public std::enable_shared_from_this private: // Constants static std::size_t constexpr max_blocks{ 10 }; - friend class active_transactions; + friend class active_elections; friend class confirmation_solicitor; public: // Only used in tests diff --git a/nano/node/inactive_node.cpp b/nano/node/inactive_node.cpp index 6ceb33ac18..69696609d5 100644 --- a/nano/node/inactive_node.cpp +++ b/nano/node/inactive_node.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/nano/node/json_handler.cpp b/nano/node/json_handler.cpp index b2ca6e5279..d1978048ef 100644 --- a/nano/node/json_handler.cpp +++ b/nano/node/json_handler.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -2039,7 +2039,7 @@ void nano::json_handler::election_statistics () } } - auto utilization_percentage = (static_cast (total_count * 100) / node.config.active_transactions.size); + auto utilization_percentage = (static_cast (total_count * 100) / node.config.active_elections.size); auto max_election_age = std::chrono::duration_cast (now - oldest_election_start).count (); auto average_election_age = total_count ? std::chrono::duration_cast (total_age).count () / total_count : 0; diff --git a/nano/node/node.cpp b/nano/node/node.cpp index 0e06033b02..e0e1736810 100644 --- a/nano/node/node.cpp +++ b/nano/node/node.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include @@ -178,7 +178,7 @@ nano::node::node (std::shared_ptr io_ctx_a, std::filesy block_processor (*this), confirming_set_impl{ std::make_unique (ledger, config.confirming_set_batch_time) }, confirming_set{ *confirming_set_impl }, - active_impl{ std::make_unique (*this, confirming_set, block_processor) }, + active_impl{ std::make_unique (*this, confirming_set, block_processor) }, active{ *active_impl }, rep_crawler (config.rep_crawler, *this), rep_tiers{ ledger, network_params, online_reps, stats, logger }, diff --git a/nano/node/node.hpp b/nano/node/node.hpp index df456c0c99..ec559e42b8 100644 --- a/nano/node/node.hpp +++ b/nano/node/node.hpp @@ -43,7 +43,7 @@ namespace nano { -class active_transactions; +class active_elections; class confirming_set; class node; class vote_processor; @@ -172,8 +172,8 @@ class node final : public std::enable_shared_from_this nano::block_processor block_processor; std::unique_ptr confirming_set_impl; nano::confirming_set & confirming_set; - std::unique_ptr active_impl; - nano::active_transactions & active; + std::unique_ptr active_impl; + nano::active_elections & active; nano::online_reps online_reps; nano::rep_crawler rep_crawler; nano::rep_tiers rep_tiers; diff --git a/nano/node/nodeconfig.cpp b/nano/node/nodeconfig.cpp index 577db2a492..050855a818 100644 --- a/nano/node/nodeconfig.cpp +++ b/nano/node/nodeconfig.cpp @@ -34,7 +34,7 @@ nano::node_config::node_config (const std::optional & peering_port_a, ipc_config{ network_params.network }, external_address{ boost::asio::ip::address_v6{}.to_string () }, rep_crawler{ network_params.network }, - active_transactions{ network_params.network }, + active_elections{ network_params.network }, block_processor{ network_params.network }, peer_history{ network_params.network }, tcp{ network_params.network } @@ -217,9 +217,9 @@ nano::error nano::node_config::serialize_toml (nano::tomlconfig & toml) const rep_crawler.serialize (rep_crawler_l); toml.put_child ("rep_crawler", rep_crawler_l); - nano::tomlconfig active_transactions_l; - active_transactions.serialize (active_transactions_l); - toml.put_child ("active_transactions", active_transactions_l); + nano::tomlconfig active_elections_l; + active_elections.serialize (active_elections_l); + toml.put_child ("active_elections", active_elections_l); nano::tomlconfig block_processor_l; block_processor.serialize (block_processor_l); @@ -314,10 +314,10 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml) rep_crawler.deserialize (config_l); } - if (toml.has_key ("active_transactions")) + if (toml.has_key ("active_elections")) { - auto config_l = toml.get_required_child ("active_transactions"); - active_transactions.deserialize (config_l); + auto config_l = toml.get_required_child ("active_elections"); + active_elections.deserialize (config_l); } if (toml.has_key ("block_processor")) @@ -531,9 +531,9 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml) { toml.get_error ().set ("io_threads must be non-zero"); } - if (active_transactions.size <= 250 && !network_params.network.is_dev_network ()) + if (active_elections.size <= 250 && !network_params.network.is_dev_network ()) { - toml.get_error ().set ("active_transactions.size must be greater than 250"); + toml.get_error ().set ("active_elections.size must be greater than 250"); } if (bandwidth_limit > std::numeric_limits::max ()) { diff --git a/nano/node/nodeconfig.hpp b/nano/node/nodeconfig.hpp index a8ec08b4bf..554fc1149f 100644 --- a/nano/node/nodeconfig.hpp +++ b/nano/node/nodeconfig.hpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -137,7 +137,7 @@ class node_config nano::vote_cache_config vote_cache; nano::rep_crawler_config rep_crawler; nano::block_processor_config block_processor; - nano::active_transactions_config active_transactions; + nano::active_elections_config active_elections; nano::vote_processor_config vote_processor; nano::peer_history_config peer_history; nano::transport::tcp_config tcp; diff --git a/nano/node/repcrawler.cpp b/nano/node/repcrawler.cpp index 3097cfade4..f8f04a4ce3 100644 --- a/nano/node/repcrawler.cpp +++ b/nano/node/repcrawler.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/nano/node/repcrawler.hpp b/nano/node/repcrawler.hpp index 0855a7bdee..5f9bbf7f7f 100644 --- a/nano/node/repcrawler.hpp +++ b/nano/node/repcrawler.hpp @@ -23,7 +23,7 @@ namespace mi = boost::multi_index; namespace nano { class node; -class active_transactions; +class active_elections; struct representative { @@ -93,7 +93,7 @@ class rep_crawler final nano::stats & stats; nano::logger & logger; nano::network_constants & network_constants; - nano::active_transactions & active; + nano::active_elections & active; private: void run (); diff --git a/nano/node/request_aggregator.cpp b/nano/node/request_aggregator.cpp index 87097c38f5..1c7b4f1ece 100644 --- a/nano/node/request_aggregator.cpp +++ b/nano/node/request_aggregator.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include @@ -12,7 +12,7 @@ #include #include -nano::request_aggregator::request_aggregator (nano::node_config const & config_a, nano::stats & stats_a, nano::vote_generator & generator_a, nano::vote_generator & final_generator_a, nano::local_vote_history & history_a, nano::ledger & ledger_a, nano::wallets & wallets_a, nano::active_transactions & active_a) : +nano::request_aggregator::request_aggregator (nano::node_config const & config_a, nano::stats & stats_a, nano::vote_generator & generator_a, nano::vote_generator & final_generator_a, nano::local_vote_history & history_a, nano::ledger & ledger_a, nano::wallets & wallets_a, nano::active_elections & active_a) : config{ config_a }, max_delay (config_a.network_params.network.is_dev_network () ? 50 : 300), small_delay (config_a.network_params.network.is_dev_network () ? 10 : 50), diff --git a/nano/node/request_aggregator.hpp b/nano/node/request_aggregator.hpp index f88a6b4faa..d48d5ec0b0 100644 --- a/nano/node/request_aggregator.hpp +++ b/nano/node/request_aggregator.hpp @@ -19,7 +19,7 @@ namespace mi = boost::multi_index; namespace nano { -class active_transactions; +class active_elections; class ledger; class local_vote_history; class node_config; @@ -62,7 +62,7 @@ class request_aggregator final // clang-format on public: - request_aggregator (nano::node_config const & config, nano::stats & stats_a, nano::vote_generator &, nano::vote_generator &, nano::local_vote_history &, nano::ledger &, nano::wallets &, nano::active_transactions &); + request_aggregator (nano::node_config const & config, nano::stats & stats_a, nano::vote_generator &, nano::vote_generator &, nano::local_vote_history &, nano::ledger &, nano::wallets &, nano::active_elections &); /** Add a new request by \p channel_a for hashes \p hashes_roots_a */ void add (std::shared_ptr const & channel_a, std::vector> const & hashes_roots_a); @@ -89,7 +89,7 @@ class request_aggregator final nano::local_vote_history & local_votes; nano::ledger & ledger; nano::wallets & wallets; - nano::active_transactions & active; + nano::active_elections & active; nano::vote_generator & generator; nano::vote_generator & final_generator; diff --git a/nano/node/scheduler/hinted.cpp b/nano/node/scheduler/hinted.cpp index 8729882f1c..6f654c65ec 100644 --- a/nano/node/scheduler/hinted.cpp +++ b/nano/node/scheduler/hinted.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include @@ -11,7 +11,7 @@ * hinted */ -nano::scheduler::hinted::hinted (hinted_config const & config_a, nano::node & node_a, nano::vote_cache & vote_cache_a, nano::active_transactions & active_a, nano::online_reps & online_reps_a, nano::stats & stats_a) : +nano::scheduler::hinted::hinted (hinted_config const & config_a, nano::node & node_a, nano::vote_cache & vote_cache_a, nano::active_elections & active_a, nano::online_reps & online_reps_a, nano::stats & stats_a) : config{ config_a }, node{ node_a }, vote_cache{ vote_cache_a }, diff --git a/nano/node/scheduler/hinted.hpp b/nano/node/scheduler/hinted.hpp index a31be55765..e26772bda2 100644 --- a/nano/node/scheduler/hinted.hpp +++ b/nano/node/scheduler/hinted.hpp @@ -20,7 +20,7 @@ namespace nano { class node; class node_config; -class active_transactions; +class active_elections; class vote_cache; class online_reps; } @@ -54,7 +54,7 @@ class hinted_config final class hinted final { public: - hinted (hinted_config const &, nano::node &, nano::vote_cache &, nano::active_transactions &, nano::online_reps &, nano::stats &); + hinted (hinted_config const &, nano::node &, nano::vote_cache &, nano::active_elections &, nano::online_reps &, nano::stats &); ~hinted (); void start (); @@ -79,7 +79,7 @@ class hinted final private: // Dependencies nano::node & node; nano::vote_cache & vote_cache; - nano::active_transactions & active; + nano::active_elections & active; nano::online_reps & online_reps; nano::stats & stats; diff --git a/nano/node/scheduler/manual.cpp b/nano/node/scheduler/manual.cpp index 3bcc83c163..787a0fbd94 100644 --- a/nano/node/scheduler/manual.cpp +++ b/nano/node/scheduler/manual.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/nano/node/scheduler/optimistic.cpp b/nano/node/scheduler/optimistic.cpp index e72dec0ac2..40f3385fc2 100644 --- a/nano/node/scheduler/optimistic.cpp +++ b/nano/node/scheduler/optimistic.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include @@ -9,7 +9,7 @@ #include #include -nano::scheduler::optimistic::optimistic (optimistic_config const & config_a, nano::node & node_a, nano::ledger & ledger_a, nano::active_transactions & active_a, nano::network_constants const & network_constants_a, nano::stats & stats_a) : +nano::scheduler::optimistic::optimistic (optimistic_config const & config_a, nano::node & node_a, nano::ledger & ledger_a, nano::active_elections & active_a, nano::network_constants const & network_constants_a, nano::stats & stats_a) : config{ config_a }, node{ node_a }, ledger{ ledger_a }, diff --git a/nano/node/scheduler/optimistic.hpp b/nano/node/scheduler/optimistic.hpp index 58531ddb4a..14318773ab 100644 --- a/nano/node/scheduler/optimistic.hpp +++ b/nano/node/scheduler/optimistic.hpp @@ -23,7 +23,7 @@ namespace mi = boost::multi_index; namespace nano { class account_info; -class active_transactions; +class active_elections; class ledger; class node; } @@ -51,7 +51,7 @@ class optimistic final struct entry; public: - optimistic (optimistic_config const &, nano::node &, nano::ledger &, nano::active_transactions &, nano::network_constants const & network_constants, nano::stats &); + optimistic (optimistic_config const &, nano::node &, nano::ledger &, nano::active_elections &, nano::network_constants const & network_constants, nano::stats &); ~optimistic (); void start (); @@ -80,7 +80,7 @@ class optimistic final optimistic_config const & config; nano::node & node; nano::ledger & ledger; - nano::active_transactions & active; + nano::active_elections & active; nano::network_constants const & network_constants; nano::stats & stats; diff --git a/nano/node/scheduler/priority.cpp b/nano/node/scheduler/priority.cpp index 8724a4491c..0a91f8e560 100644 --- a/nano/node/scheduler/priority.cpp +++ b/nano/node/scheduler/priority.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/nano/node/vote_cache.hpp b/nano/node/vote_cache.hpp index 55d1256cf6..5658d0832b 100644 --- a/nano/node/vote_cache.hpp +++ b/nano/node/vote_cache.hpp @@ -24,7 +24,7 @@ namespace mi = boost::multi_index; namespace nano { class node; -class active_transactions; +class active_elections; class election; class vote; } diff --git a/nano/node/vote_processor.cpp b/nano/node/vote_processor.cpp index 40dc22370b..8c718da74d 100644 --- a/nano/node/vote_processor.cpp +++ b/nano/node/vote_processor.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include @@ -15,7 +15,7 @@ using namespace std::chrono_literals; -nano::vote_processor::vote_processor (vote_processor_config const & config_a, nano::active_transactions & active_a, nano::node_observers & observers_a, nano::stats & stats_a, nano::node_flags & flags_a, nano::logger & logger_a, nano::online_reps & online_reps_a, nano::rep_crawler & rep_crawler_a, nano::ledger & ledger_a, nano::network_params & network_params_a, nano::rep_tiers & rep_tiers_a) : +nano::vote_processor::vote_processor (vote_processor_config const & config_a, nano::active_elections & active_a, nano::node_observers & observers_a, nano::stats & stats_a, nano::node_flags & flags_a, nano::logger & logger_a, nano::online_reps & online_reps_a, nano::rep_crawler & rep_crawler_a, nano::ledger & ledger_a, nano::network_params & network_params_a, nano::rep_tiers & rep_tiers_a) : config{ config_a }, active{ active_a }, observers{ observers_a }, diff --git a/nano/node/vote_processor.hpp b/nano/node/vote_processor.hpp index 43659cff06..d6c4628072 100644 --- a/nano/node/vote_processor.hpp +++ b/nano/node/vote_processor.hpp @@ -14,7 +14,7 @@ namespace nano { -class active_transactions; +class active_elections; namespace store { class component; @@ -56,7 +56,7 @@ class vote_processor_config final class vote_processor final { public: - vote_processor (vote_processor_config const &, nano::active_transactions &, nano::node_observers &, nano::stats &, nano::node_flags &, nano::logger &, nano::online_reps &, nano::rep_crawler &, nano::ledger &, nano::network_params &, nano::rep_tiers &); + vote_processor (vote_processor_config const &, nano::active_elections &, nano::node_observers &, nano::stats &, nano::node_flags &, nano::logger &, nano::online_reps &, nano::rep_crawler &, nano::ledger &, nano::network_params &, nano::rep_tiers &); ~vote_processor (); void start (); @@ -75,7 +75,7 @@ class vote_processor final private: // Dependencies vote_processor_config const & config; - nano::active_transactions & active; + nano::active_elections & active; nano::node_observers & observers; nano::stats & stats; nano::logger & logger; diff --git a/nano/rpc_test/rpc.cpp b/nano/rpc_test/rpc.cpp index 3032daf5de..e26b8b116b 100644 --- a/nano/rpc_test/rpc.cpp +++ b/nano/rpc_test/rpc.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/nano/slow_test/node.cpp b/nano/slow_test/node.cpp index c6b4c872df..2a7455ffbd 100644 --- a/nano/slow_test/node.cpp +++ b/nano/slow_test/node.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include @@ -995,7 +995,7 @@ TEST (confirmation_height, many_accounts_send_receive_self) nano::node_config node_config = system.default_config (); node_config.online_weight_minimum = 100; node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; - node_config.active_transactions.size = 400000; + node_config.active_elections.size = 400000; nano::node_flags node_flags; auto node = system.add_node (node_config); system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); diff --git a/nano/slow_test/vote_cache.cpp b/nano/slow_test/vote_cache.cpp index 73ecba40e9..32a105cdc8 100644 --- a/nano/slow_test/vote_cache.cpp +++ b/nano/slow_test/vote_cache.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include diff --git a/nano/test_common/system.cpp b/nano/test_common/system.cpp index d3ede54f24..ce6950e896 100644 --- a/nano/test_common/system.cpp +++ b/nano/test_common/system.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/nano/test_common/testutil.cpp b/nano/test_common/testutil.cpp index d8500fdf47..493672c0b9 100644 --- a/nano/test_common/testutil.cpp +++ b/nano/test_common/testutil.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include