pub(crate) fn pc_to_lock<K: KVStore>(
justify: &PhaseCertificate,
block_tree: &BlockTreeSingleton<K>,
) -> Result<Option<PhaseCertificate>, BlockTreeError>Expand description
Get the PC (if any) that should be set as the Locked PC after the replica sees the given justify.
§Precondition
The block or nudge containing this justify must satisfy safe_block or safe_nudge
respectively.
§pc_to_lock logic
pc_to_lock’s return value depends on justify’s phase and whether or not it is the Genesis PC.
What pc_to_lock returns in every case is summarized in the below table:
justify is the/a | PC to lock if not already the current locked PC |
|---|---|
| Genesis PC | None |
Generic PC | justify.block.justify |
Prepare PC | None |
Precommit PC | justify |
Commit PC | justify |
Decide PC | justify |
§Rationale
The rationale behind pc_to_lock’s logic is explained in the “Locking”
module-level docs.