Constructing with a given height #98
Merged
+50
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the feature of being able to construct a replica that will start at a given height. Using this feature also fixes a problem that can occur when trying to start a replica at a later height (for instance if blocks are being stored to disk, and consensus is restarted after a crash, you would want to start from the height after the latest stored block). The problem is as follows. The usage code will usually take the form
The call to
ResetHeight
will simply add a message to the message queue, to be eventually processed by the event loop inreplica.Run
. However,replica.Run
before entering the event loop will callprocess.Start
which will run proposal logic and hence if the process is the current proposer for height 1 round 0 it will send out a proposal, which we want to avoid but cannot, as this will always happen before the reset height message can be processed. This can cause consensus to halt in some situations. Using a constructor that allows the process to start at the desired height resolves this issue.