diff --git a/lib/modules-lib/bc-db-reader/src/current_frame.rs b/lib/modules-lib/bc-db-reader/src/current_frame.rs index 07e3259916ab50c705cc03a90d90b1f113169fe0..bb4f35fe844ecb8a36fa9238ada5ed6a9d8129e4 100644 --- a/lib/modules-lib/bc-db-reader/src/current_frame.rs +++ b/lib/modules-lib/bc-db-reader/src/current_frame.rs @@ -58,6 +58,7 @@ pub fn get_member_diffi<DB: DbReadable, R: DbReader>( unimplemented!(); } + /// calcule la difficulté personnalisée à partir des données prêtes à l'emploi /// reference dans le protocol : https://github.com/duniter/duniter/blob/master/doc/Protocol.md#br_g18---headpowzeros-and-headpowremainder pub fn compute_personal_difficulty( @@ -148,4 +149,25 @@ mod tests { compute_personal_difficulty(50, BlockNumber(1000), BlockNumber(1010), 5, 1) ); } + + // test avec db mockée + // #[test] + // fn test_personal_difficulty_member_not_in_frame() -> Result<(), DbError> { + // let db = crate::tests::open_tmp_db()?; + // db.write(|mut w| { + // //common::insert_wot_index_entry(&db, &mut w, WotId(0), issuer_a)?; + // Ok(w) + // })?; + // db.read(|r| { + // //common::insert_wot_index_entry(&db, &mut w, WotId(0), issuer_a)?; + // assert_eq!( + // PersonalDifficulty { + // exclusion_factor: 1, + // handicap: 0 + // }, + // get_member_diffi(db,r, WotId(0)) + // ); + // })?; + + // } }