Prevent lazy destinations usage if legacy bootstrap is enabled
This commit is contained in:
parent
52dee5ee91
commit
3a3c56a5d2
2 changed files with 16 additions and 11 deletions
|
|
@ -1184,17 +1184,21 @@ void nano::bootstrap_attempt::lazy_backlog_cleanup ()
|
||||||
|
|
||||||
void nano::bootstrap_attempt::lazy_destinations_increment (nano::account const & destination_a)
|
void nano::bootstrap_attempt::lazy_destinations_increment (nano::account const & destination_a)
|
||||||
{
|
{
|
||||||
// Update accounts counter for send blocks
|
// Enabled only if legacy bootstrap is not available. Legacy bootstrap is a more effective way to receive all existing destinations
|
||||||
auto existing (lazy_destinations.get<account_tag> ().find (destination_a));
|
if (node->flags.disable_legacy_bootstrap)
|
||||||
if (existing != lazy_destinations.get<account_tag> ().end ())
|
|
||||||
{
|
{
|
||||||
lazy_destinations.get<account_tag> ().modify (existing, [](nano::lazy_destinations_item & item_a) {
|
// Update accounts counter for send blocks
|
||||||
++item_a.count;
|
auto existing (lazy_destinations.get<account_tag> ().find (destination_a));
|
||||||
});
|
if (existing != lazy_destinations.get<account_tag> ().end ())
|
||||||
}
|
{
|
||||||
else
|
lazy_destinations.get<account_tag> ().modify (existing, [](nano::lazy_destinations_item & item_a) {
|
||||||
{
|
++item_a.count;
|
||||||
lazy_destinations.insert (nano::lazy_destinations_item{ destination_a, 1 });
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lazy_destinations.insert (nano::lazy_destinations_item{ destination_a, 1 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,8 @@ void nano::bulk_pull_client::received_block (boost::system::error_code const & e
|
||||||
}
|
}
|
||||||
// Is block expected?
|
// Is block expected?
|
||||||
bool block_expected (false);
|
bool block_expected (false);
|
||||||
bool unconfirmed_account_head (pull_blocks == 0 && pull.retry_limit != std::numeric_limits<unsigned>::max () && expected == pull.account_or_head && block->account () == pull.account_or_head);
|
// Unconfirmed head is used only for lazy destinations if legacy bootstrap is not available, see nano::bootstrap_attempt::lazy_destinations_increment (...)
|
||||||
|
bool unconfirmed_account_head (connection->node->flags.disable_legacy_bootstrap && pull_blocks == 0 && pull.retry_limit != std::numeric_limits<unsigned>::max () && expected == pull.account_or_head && block->account () == pull.account_or_head);
|
||||||
if (hash == expected || unconfirmed_account_head)
|
if (hash == expected || unconfirmed_account_head)
|
||||||
{
|
{
|
||||||
expected = block->previous ();
|
expected = block->previous ();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue