-
Notifications
You must be signed in to change notification settings - Fork 236
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
feat(sync): print epoch statistics in_IBD instead of each block #3443
Conversation
chain/src/chain.rs
Outdated
if self.shared.is_initial_block_download() { | ||
self.update_print_statics(&block, &tip_header, total_difficulty.clone()); | ||
} else { | ||
info!( | ||
"block: {}, hash: {:#x}, epoch: {:#}, total_diff: {:#x}, txs: {}", | ||
tip_header.number(), | ||
tip_header.hash(), | ||
tip_header.epoch(), | ||
total_difficulty, | ||
block.transactions().len() | ||
); | ||
} |
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.
suggest to move all log related code to a single fn, it can reduce duplicate code, for example info!("block: {}...
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.
i just move related info_block call into standalone functions, but not all functions can be merged into single function, due to message format.
chain/src/chain.rs
Outdated
) { | ||
let tip_epoch = tip_header.epoch(); | ||
|
||
if tip_epoch.index() == 0 { |
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.
It is recommended to change the comparison logic to compare block number against epoch starting number plus epoch length, which will reduce the complexity of the code.
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.
Good advice!
i refactor this part, please help to check.
i'm not sure about if the code is the best way to tell first_block/last_block number of each epoch.
chain/src/chain.rs
Outdated
cycles, | ||
self.shared.consensus().max_block_cycles() | ||
); | ||
if !self.shared.is_initial_block_download() { |
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.
why disable this log in ibd?
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.
original block printing is as:
block #12 info...........
[block verifier] block #12 info... cycles: ....
my previous thoughts was omit both block and verifier print, but if you suggest to keep it, and i also think cycles information cannot be fetch from database, mabey keep it in log file is also usable...so i keep it.
e6d609c
to
f04884d
Compare
f04884d
to
78de4be
Compare
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
What problem does this PR solve?
Problem Summary: Print 1st block in each epoch and previous epoch statistics information, when syncing node is in IBD
What is changed and how it works?
What's Changed:
running output as:
Related changes
owner/repo
:Tests
Side effects
Release note