fn cache_signature(lc: &mut LinearChain, fs: FinalitySignature) {
        // We need to signal that block is known. Otherwise we won't cache the signature.
        let mut block_signatures = BlockSignatures::new(fs.block_hash, fs.era_id);
        let outcomes = lc.handle_cached_signatures(
            Some(Box::new(block_signatures.clone())),
            Box::new(fs.clone()),
        );
        match &*outcomes {
            [Outcome::VerifyIfBonded {
                new_fs, known_fs, ..
            }] => {
                assert_eq!(&fs, &**new_fs);
                let outcomes = lc.handle_is_bonded(known_fs.clone(), Box::new(fs.clone()), true);
                // After confirming that signature is valid and block known, we want to store the
                // signature and announce it.
                match &*outcomes {
                    [Outcome::AnnounceSignature(outcome_fs), Outcome::StoreBlockSignatures(outcome_block_signatures)] =>
                    {
                        assert_eq!(&fs, &**outcome_fs);
                        // LinearChain component will update the `block_signatures` with a new
                        // signature for storage.
                        block_signatures.insert_proof(fs.public_key, fs.signature);
                        assert_eq!(&block_signatures, outcome_block_signatures);
                    }
                    others => panic!("unexpected outcomes {:?}", others),
                }
            }
            others => panic!("unexpected outcomes {:?}", others),
        }
    }
// Forces caching of the finality signature. Requires confirming that creator is known to be
// bonded.
Forces caching of the finality signature. Requires confirming that creator is known to be
bonded.
Forces caching of the finality signature . Requires confirming that creator is known to be bonded .
fn cache_signature(lc: &mut LinearChain, fs: FinalitySignature) {
        // We need to signal that block is known. Otherwise we won't cache the signature.
        let mut block_signatures = BlockSignatures::new(fs.block_hash, fs.era_id);
        let outcomes = lc.handle_cached_signatures(
            Some(Box::new(block_signatures.clone())),
            Box::new(fs.clone()),
        );
        match &*outcomes {
            [Outcome::VerifyIfBonded {
                new_fs, known_fs, ..
            }] => {
                assert_eq!(&fs, &**new_fs);
                let outcomes = lc.handle_is_bonded(known_fs.clone(), Box::new(fs.clone()), true);
                // After confirming that signature is valid and block known, we want to store the
                // signature and announce it.
                match &*outcomes {
                    [Outcome::AnnounceSignature(outcome_fs), Outcome::StoreBlockSignatures(outcome_block_signatures)] =>
                    {
                        assert_eq!(&fs, &**outcome_fs);
                        // LinearChain component will update the `block_signatures` with a new
                        // signature for storage.
                        block_signatures.insert_proof(fs.public_key, fs.signature);
                        assert_eq!(&block_signatures, outcome_block_signatures);
                    }
                    others => panic!("unexpected outcomes {:?}", others),
                }
            }
            others => panic!("unexpected outcomes {:?}", others),
        }
    }
fn cache_signature ( lc : & mut LinearChain , fs : FinalitySignature ) { // We need to signal that block is known. Otherwise we won't cache the signature. let mut block_signatures = BlockSignatures :: new ( fs . block_hash , fs . era_id ) ; let outcomes = lc . handle_cached_signatures ( Some ( Box :: new ( block_signatures . clone ( ) ) ) , Box :: new ( fs . clone ( ) ) , ) ; match & * outcomes { [ Outcome :: VerifyIfBonded { new_fs , known_fs , .. } ] => { assert_eq ! ( fs new_fs ) ; let outcomes = lc . handle_is_bonded ( known_fs . clone ( ) , Box :: new ( fs . clone ( ) ) , true ) ; // After confirming that signature is valid and block known, we want to store the // signature and announce it. match & * outcomes { [ Outcome :: AnnounceSignature ( outcome_fs ) , Outcome :: StoreBlockSignatures ( outcome_block_signatures ) ] => { assert_eq ! ( fs outcome_fs ) ; // LinearChain component will update the `block_signatures` with a new // signature for storage. block_signatures . insert_proof ( fs . public_key , fs . signature ) ; assert_eq ! ( block_signatures outcome_block_signatures ) ; } others => panic ! ( " " others ) , } } others => panic ! ( " " others ) , } }
Forces caching of the finality signature.
Forces caching of the finality signature .
lc
&mut LinearChain
fs
FinalitySignature
lc
&mut LinearChain
fs
FinalitySignature