pub(crate) fn safe_pc<K: KVStore>(
pc: &PhaseCertificate,
block_tree: &BlockTreeSingleton<K>,
chain_id: ChainID,
) -> Result<bool, BlockTreeError>
Expand description
Check whether pc
can safely cause updates to block_tree
, given the replica’s chain_id
.
§Conditional checks
safe_pc
returns true
in case all of the following predicates are true
:
- Either
pc.chain_id
equalschain_id
, orpc
is the Genesis PC. - Either
block_tree
containspc.block
, orpc
is the Genesis PC. - Either
pc.view
is (strictly) greater thanblock_tree
’slocked_pc.view
, orpc.block
extends fromlocked_pc.block
. - If
pc.phase
isPrepare
,Precommit
,Commit
, orDecide
,pc.block
is a validator set updating block. Else, ifpc.phase
isGeneric
,pc.block
is not a validator set updating block.
§Precondition
is_correct
is true
for block.justify
.