Function finality_grandpa::validate_commit
source · pub fn validate_commit<H, N, S, I, C: Chain<H, N>>(
commit: &Commit<H, N, S, I>,
voters: &VoterSet<I>,
chain: &C
) -> Result<CommitValidationResult, Error>where
H: Clone + Eq + Ord + Debug,
N: Copy + BlockNumberOps + Debug,
I: Clone + Ord + Eq + Debug,
S: Clone + Eq,
Expand description
Validates a GRANDPA commit message.
For a commit to be valid the round ghost is calculated using the precommits in the commit message, making sure that it exists and that it is the same as the commit target. The precommit with the lowest block number is used as the round base.
Signatures on precommits are assumed to have been checked.
Duplicate votes or votes from voters not in the voter-set will be ignored, but it is recommended for the caller of this function to remove those at signature-verification time.