Skip to content

Commit

Permalink
mobile verifier rewarder should validate there are unique connections… (
Browse files Browse the repository at this point in the history
#917)

* mobile verifier rewarder should validate there are unique connections within rewardable period not next period

* and reward_period end to no_unique_connections check
  • Loading branch information
bbalser authored Dec 16, 2024
1 parent 1827835 commit 989ce69
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mobile_verifier/src/rewarder/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ pub async fn no_unique_connections(
reward_period: &Range<DateTime<Utc>>,
) -> anyhow::Result<bool> {
let count = sqlx::query_scalar::<_, i64>(
"SELECT COUNT(*) from unique_connections WHERE received_timestamp >= $1",
"SELECT COUNT(*) from unique_connections WHERE received_timestamp >= $1 and received_timestamp < $2",
)
.bind(reward_period.start)
.bind(reward_period.end)
.fetch_one(pool)
.await?;
Expand Down Expand Up @@ -203,7 +204,7 @@ mod tests {
};

let unique_connection = file_store::UniqueConnectionsIngestReport {
received_timestamp: timestamp,
received_timestamp: timestamp - chrono::Duration::seconds(1),
report: file_store::UniqueConnectionReq {
pubkey: cbrs_pubkey_bin.clone(),
start_timestamp: Utc::now() - chrono::Duration::days(7),
Expand Down

0 comments on commit 989ce69

Please sign in to comment.