-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.0] Limit sync-fetch-span by max-reversible-blocks if needed #545
Conversation
plugins/net_plugin/net_plugin.cpp
Outdated
,sync_state(in_sync) | ||
,min_blocks_distance(min_blocks_distance) | ||
{ | ||
} | ||
|
||
uint32_t sync_manager::active_sync_fetch_span() const { | ||
auto fork_db_size = my_impl->chain_plug->chain().fork_db_size(); | ||
auto reversible_remaining = max_reversible_blocks - fork_db_size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shutdown when fork_db_size() >= max_reversible_blocks
, so really we should have:
auto reversible_remaining = max_reversible_blocks - fork_db_size; | |
auto reversible_remaining = max_reversible_blocks - fork_db_size - 1; |
I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check max_reversible_blocks > fork_db_size
before doing subtract?
plugins/net_plugin/net_plugin.cpp
Outdated
// block was not applied, possibly because we already have the block | ||
fc_dlog(logger, "Requesting ${fs} blocks ahead, head: ${h} fhead ${fh} blk_num: ${bn} sync_next_expected_num ${nen} " | ||
"sync_last_requested_num: ${lrn}, sync_last_requested_block: ${lrb}", | ||
("fs", fetch_span)("h", my_impl->get_chain_head_num())("fh", my_impl->get_fork_head_num()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
("fs", fetch_span)("h", my_impl->get_chain_head_num())("fh", my_impl->get_fork_head_num()) | |
("fs", fetch_span)("h", head)("fh", my_impl->get_fork_head_num()) |
Note:start |
Example output:
Resolves #528