Skip to main content

conditional_self_test

Function conditional_self_test 

Source
pub fn conditional_self_test(result: Result<()>) -> Result<()>
Expand description

Pass on the result of a conditional self-test, entering the error state if it failed.

A conditional self-test is one a module runs on its own work as it goes: the pairwise consistency test on a key pair it has just generated. Its input is the module’s own output, never a caller’s, so a failure is not something a peer can cause – it means this module computed two things that should agree and do not, and nothing it computes afterwards can be vouched for.

Key generation wraps its test in this. The test functions themselves do not enter the state, so that they can be shown rejecting a mismatched pair without ending the process that shows it.