Pay the block propose rewards at the end of the term#1559
Pay the block propose rewards at the end of the term#1559mergify[bot] merged 6 commits intoCodeChain-io:masterfrom sgkim126:fee
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.
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.
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.
No description provided.