Skip to content

Commit 1679d30

Browse files
Juhyung ParkPark Juhyung
authored andcommitted
Add a comment for height change functions about the step field
Changing the height is a light action. Height change functions change all fields in Tendermint Worker except the `step` field. `move_to_step` function changes the `step` field and does many other things, such as sending the current state to other peers, requesting other peers regarding votes, starting a timer, etc. The side-effect of the `move_to_step` function is that the `move_to_the_next_height` function and the `jump_to_height` function do not call `move_to_step`. The caller of the height change functions should call the `move_tp_step` function.
1 parent 79322e1 commit 1679d30

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/src/consensus/tendermint/worker.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,8 @@ impl Worker {
628628
}
629629

630630
/// Move to the next height.
631+
/// Since changing the `step` needs many things to do, this function does not change the `step` variable.
632+
/// The caller should call `move_to_step` after calling this function.
631633
fn move_to_the_next_height(&mut self) {
632634
assert!(
633635
self.step.is_commit(),
@@ -648,6 +650,8 @@ impl Worker {
648650
/// Jump to the height.
649651
/// This function is called when new blocks are received from block sync.
650652
/// This function could be called at any state.
653+
/// Since changing the `step` needs many things to do, this function does not change the `step` variable.
654+
/// The caller should call `move_to_step` after calling this function.
651655
fn jump_to_height(&mut self, height: Height, finalized_view_of_previous_height: View) {
652656
assert!(height > self.height, "{} < {}", height, self.height);
653657
cinfo!(ENGINE, "Transitioning to height {}.", height);

0 commit comments

Comments
 (0)