-
Notifications
You must be signed in to change notification settings - Fork 51
Pay the block propose rewards at the end of the term #1559
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
Conversation
It depens on #1535 |
The last commit based on #1562. |
Sorry. I found that |
@majecty @foriequal0 |
.ok_or(EngineError::CannotOpenBlock)?; | ||
|
||
let (start_of_the_next_term, start_of_the_current_term) = { | ||
let end_of_the_previous_term = block.state().metadata()?.unwrap().last_term_finished_block_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.
I'm confusing what is the {current, next, previous} terms.
term id
is calculated by the header.timestamp. The block
in this function has different term
which is calculated from the header, and the block's term is term id - 1
. Am I right?
What is the current term? Is it from the block's timestamp or from the 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.
Yes. It's the most confusing part because the current block is the end of the term but the term Id in the metadata is not updated.
The current term in this context is the term that this block closes. The reason which uses the current block to calculate end_of_the_previous_term
is that because the last block of the previous term is stored in states.
@majecty I updated the PR. |
Currently, the block reward is paid per block; this patch makes the reward is paid at the end of the term if the term seconds is determined. Solo and Tendermint are different. Solo pays the fee at the end of the term, but Tendermint pays the fee at the end of the next term.
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.
LGTM
No description provided.