fn check_state(
        ecdsa_pool: &EcdsaPoolImpl,
        unvalidated_expected: &[EcdsaMessageHash],
        validated_expected: &[EcdsaMessageHash],
    ) {
        let unvalidated_expected =
            unvalidated_expected
                .iter()
                .fold(BTreeSet::new(), |mut acc, id| {
                    acc.insert(id);
                    acc
                });
        let validated_expected = validated_expected
            .iter()
            .fold(BTreeSet::new(), |mut acc, id| {
                acc.insert(id);
                acc
            });

        let unvalidated =
            ecdsa_pool
                .unvalidated()
                .signed_dealings()
                .fold(BTreeSet::new(), |mut acc, (id, _)| {
                    acc.insert(id);
                    acc
                });
        let validated =
            ecdsa_pool
                .validated()
                .signed_dealings()
                .fold(BTreeSet::new(), |mut acc, (id, _)| {
                    acc.insert(id);
                    acc
                });

        assert_eq!(validated.len(), validated_expected.len());
        for id in &validated {
            assert!(validated_expected.contains(id));
            assert!(ecdsa_pool.contains(id));
            assert!(ecdsa_pool.get_validated_by_identifier(id).is_some());

            assert!(ecdsa_pool.validated().contains(id));
            assert!(ecdsa_pool.validated().get(id).is_some());

            assert!(!ecdsa_pool.unvalidated().contains(id));
            assert!(ecdsa_pool.unvalidated().get(id).is_none());
        }

        assert_eq!(unvalidated.len(), unvalidated_expected.len());
        for id in &unvalidated {
            assert!(unvalidated_expected.contains(id));
            assert!(ecdsa_pool.contains(id));
            assert!(ecdsa_pool.get_validated_by_identifier(id).is_none());

            assert!(ecdsa_pool.unvalidated().contains(id));
            assert!(ecdsa_pool.unvalidated().get(id).is_some());

            assert!(!ecdsa_pool.validated().contains(id));
            assert!(ecdsa_pool.validated().get(id).is_none());
        }
    }
// Checks if the validated/unvalidated pool members are as expected
Checks if the validated/unvalidated pool members are as expected
Checks if the validated / unvalidated pool members are as expected
fn check_state(
        ecdsa_pool: &EcdsaPoolImpl,
        unvalidated_expected: &[EcdsaMessageHash],
        validated_expected: &[EcdsaMessageHash],
    ) {
        let unvalidated_expected =
            unvalidated_expected
                .iter()
                .fold(BTreeSet::new(), |mut acc, id| {
                    acc.insert(id);
                    acc
                });
        let validated_expected = validated_expected
            .iter()
            .fold(BTreeSet::new(), |mut acc, id| {
                acc.insert(id);
                acc
            });
        let unvalidated =
            ecdsa_pool
                .unvalidated()
                .signed_dealings()
                .fold(BTreeSet::new(), |mut acc, (id, _)| {
                    acc.insert(id);
                    acc
                });
        let validated =
            ecdsa_pool
                .validated()
                .signed_dealings()
                .fold(BTreeSet::new(), |mut acc, (id, _)| {
                    acc.insert(id);
                    acc
                });
        assert_eq!(validated.len(), validated_expected.len());
        for id in &validated {
            assert!(validated_expected.contains(id));
            assert!(ecdsa_pool.contains(id));
            assert!(ecdsa_pool.get_validated_by_identifier(id).is_some());
            assert!(ecdsa_pool.validated().contains(id));
            assert!(ecdsa_pool.validated().get(id).is_some());
            assert!(!ecdsa_pool.unvalidated().contains(id));
            assert!(ecdsa_pool.unvalidated().get(id).is_none());
        }
        assert_eq!(unvalidated.len(), unvalidated_expected.len());
        for id in &unvalidated {
            assert!(unvalidated_expected.contains(id));
            assert!(ecdsa_pool.contains(id));
            assert!(ecdsa_pool.get_validated_by_identifier(id).is_none());
            assert!(ecdsa_pool.unvalidated().contains(id));
            assert!(ecdsa_pool.unvalidated().get(id).is_some());
            assert!(!ecdsa_pool.validated().contains(id));
            assert!(ecdsa_pool.validated().get(id).is_none());
        }
    }
fn check_state ( ecdsa_pool : & EcdsaPoolImpl , unvalidated_expected : & [ EcdsaMessageHash ] , validated_expected : & [ EcdsaMessageHash ] , ) { let unvalidated_expected = unvalidated_expected . iter ( ) . fold ( BTreeSet :: new ( ) , | mut acc , id | { acc . insert ( id ) ; acc } ) ; let validated_expected = validated_expected . iter ( ) . fold ( BTreeSet :: new ( ) , | mut acc , id | { acc . insert ( id ) ; acc } ) ; let unvalidated = ecdsa_pool . unvalidated ( ) . signed_dealings ( ) . fold ( BTreeSet :: new ( ) , | mut acc , ( id , _ ) | { acc . insert ( id ) ; acc } ) ; let validated = ecdsa_pool . validated ( ) . signed_dealings ( ) . fold ( BTreeSet :: new ( ) , | mut acc , ( id , _ ) | { acc . insert ( id ) ; acc } ) ; assert_eq ! ( validated len ( ) validated_expected len ( ) ) ; for id in & validated { assert ! ( validated_expected contains ( id ) ) ; assert ! ( ecdsa_pool contains ( id ) ) ; assert ! ( ecdsa_pool get_validated_by_identifier ( id ) is_some ( ) ) ; assert ! ( ecdsa_pool validated ( ) contains ( id ) ) ; assert ! ( ecdsa_pool validated ( ) get ( id ) is_some ( ) ) ; assert ! ( ecdsa_pool unvalidated ( ) contains ( id ) ) ; assert ! ( ecdsa_pool unvalidated ( ) get ( id ) is_none ( ) ) ; } assert_eq ! ( unvalidated len ( ) unvalidated_expected len ( ) ) ; for id in & unvalidated { assert ! ( unvalidated_expected contains ( id ) ) ; assert ! ( ecdsa_pool contains ( id ) ) ; assert ! ( ecdsa_pool get_validated_by_identifier ( id ) is_none ( ) ) ; assert ! ( ecdsa_pool unvalidated ( ) contains ( id ) ) ; assert ! ( ecdsa_pool unvalidated ( ) get ( id ) is_some ( ) ) ; assert ! ( ecdsa_pool validated ( ) contains ( id ) ) ; assert ! ( ecdsa_pool validated ( ) get ( id ) is_none ( ) ) ; } }
Checks if the validated/unvalidated pool members are as expected
Checks if the validated / unvalidated pool members are as expected
ecdsa_pool
&EcdsaPoolImpl
unvalidated_expected
&[EcdsaMessageHash]
validated_expected
&[EcdsaMessageHash]
ecdsa_pool
&EcdsaPoolImpl
unvalidated_expected
&[EcdsaMessageHash]
validated_expected
&[EcdsaMessageHash]