feat: track maximum recorded nonce for captcha levels to render progress bar

This commit is contained in:
Aravinth Manivannan
2023-10-29 06:18:01 +05:30
parent 49a8757ead
commit b6497882d7
12 changed files with 356 additions and 0 deletions

View File

@@ -292,6 +292,21 @@ pub trait MCDatabase: std::marker::Send + std::marker::Sync + CloneSPDatabase {
/// Get all psuedo IDs
async fn analytics_get_all_psuedo_ids(&self, page: usize) -> DBResult<Vec<String>>;
/// Track maximum nonce received against captcha levels
async fn update_max_nonce_for_level(
&self,
captcha_key: &str,
difficulty_factor: u32,
latest_nonce: u32,
) -> DBResult<()>;
/// Get maximum nonce tracked so far for captcha levels
async fn get_max_nonce_for_level(
&self,
captcha_key: &str,
difficulty_factor: u32,
) -> DBResult<u32>;
}
#[derive(Debug, Clone, Default, Deserialize, Serialize, PartialEq)]