Bandwidth considerations following election refactor (#2646)
* Bandwidth considerations with election refactor - Block broadcasting is used as a backup mechanism, now only done after and every 20 seconds - Reduced send_confirm_req period from 15 to 5 seconds, as it is the primary mechanism and only targets representatives that haven't voted yet - Increased time to activate dependencies ensuring at least one block broadcast is performed * Initial flood for elections created via node::block_confirm * Revert "Initial flood for elections created via node::block_confirm" Following Colin review, this reverts commit bdb200ab09ad3e2c0cb7b709045599c374c8695f.
This commit is contained in:
parent
90b754ca48
commit
a1eaad592e
2 changed files with 5 additions and 13 deletions
|
|
@ -152,7 +152,7 @@ bool nano::election::state_change (nano::election::state_t expected_a, nano::ele
|
|||
|
||||
void nano::election::send_confirm_req (nano::confirmation_solicitor & solicitor_a)
|
||||
{
|
||||
if (last_req + std::chrono::seconds (15) < std::chrono::steady_clock::now ())
|
||||
if (base_latency () * 5 < std::chrono::steady_clock::now () - last_req)
|
||||
{
|
||||
if (!solicitor_a.add (*this))
|
||||
{
|
||||
|
|
@ -181,14 +181,7 @@ void nano::election::transition_active ()
|
|||
|
||||
void nano::election::transition_active_impl ()
|
||||
{
|
||||
if (!state_change (nano::election::state_t::idle, nano::election::state_t::active))
|
||||
{
|
||||
if (base_latency () * 5 < std::chrono::steady_clock::now () - last_block)
|
||||
{
|
||||
last_block = std::chrono::steady_clock::now ();
|
||||
node.network.flood_block (status.winner);
|
||||
}
|
||||
}
|
||||
state_change (nano::election::state_t::idle, nano::election::state_t::active);
|
||||
}
|
||||
|
||||
bool nano::election::idle () const
|
||||
|
|
@ -247,7 +240,7 @@ void nano::election::activate_dependencies ()
|
|||
|
||||
void nano::election::broadcast_block (nano::confirmation_solicitor & solicitor_a)
|
||||
{
|
||||
if (base_latency () * 5 < std::chrono::steady_clock::now () - last_block)
|
||||
if (base_latency () * 20 < std::chrono::steady_clock::now () - last_block)
|
||||
{
|
||||
if (!solicitor_a.broadcast (*this))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ private: // State management
|
|||
expired_unconfirmed
|
||||
};
|
||||
static int constexpr passive_duration_factor = 5;
|
||||
static int constexpr active_duration_factor = 20;
|
||||
static int constexpr active_duration_factor = 30;
|
||||
static int constexpr confirmed_duration_factor = 10;
|
||||
static int constexpr confirmed_duration_factor_saturated = 1;
|
||||
std::atomic<nano::election::state_t> state_m = { state_t::idle };
|
||||
|
|
@ -55,8 +55,7 @@ private: // State management
|
|||
// Protects state_start, last_vote and last_block
|
||||
std::mutex timepoints_mutex;
|
||||
std::chrono::steady_clock::time_point state_start = { std::chrono::steady_clock::now () };
|
||||
std::chrono::steady_clock::time_point last_vote = { std::chrono::steady_clock::time_point () };
|
||||
std::chrono::steady_clock::time_point last_block = { std::chrono::steady_clock::time_point () };
|
||||
std::chrono::steady_clock::time_point last_block = { std::chrono::steady_clock::now () };
|
||||
std::chrono::steady_clock::time_point last_req = { std::chrono::steady_clock::time_point () };
|
||||
|
||||
bool valid_change (nano::election::state_t, nano::election::state_t) const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue