Skip to content

Commit

Permalink
Allow SpeedtestTier::Poor to work
Browse files Browse the repository at this point in the history
  • Loading branch information
macpie committed Dec 12, 2024
1 parent ba1328d commit 6a4ddaf
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions mobile_verifier/src/reward_shares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ fn eligible_for_coverage_map(
}

let avg_speedtest = Speedtest::avg(speedtests);
if !is_tier_eligible(avg_speedtest.tier()) {
if avg_speedtest.tier() == SpeedtestTier::Fail {
return false;
}

Expand All @@ -803,13 +803,6 @@ fn eligible_for_coverage_map(
true
}

fn is_tier_eligible(tier: SpeedtestTier) -> bool {
matches!(
tier,
SpeedtestTier::Good | SpeedtestTier::Acceptable | SpeedtestTier::Degraded
)
}

fn average_trust_score(trust_scores: &[LocationTrust]) -> Decimal {
if trust_scores.is_empty() {
return dec!(0);
Expand Down Expand Up @@ -1237,7 +1230,7 @@ mod test {
timestamp,
upload_speed: bytes_per_s(10),
download_speed: bytes_per_s(100),
latency: 10,
latency: 50,
serial: "".to_string(),
},
};
Expand All @@ -1247,7 +1240,7 @@ mod test {
timestamp,
upload_speed: bytes_per_s(20),
download_speed: bytes_per_s(200),
latency: 20,
latency: 100,
serial: "".to_string(),
},
};
Expand Down Expand Up @@ -1290,7 +1283,7 @@ mod test {
let speedtest_avg = radio_reward.speedtest_average.unwrap();
assert_eq!(speedtest_avg.upload_speed_bps, bytes_per_s(15));
assert_eq!(speedtest_avg.download_speed_bps, bytes_per_s(150));
assert_eq!(speedtest_avg.latency_ms, 15);
assert_eq!(speedtest_avg.latency_ms, 75);
}

/// Test to ensure that different speedtest averages correctly afferct reward shares.
Expand Down

0 comments on commit 6a4ddaf

Please sign in to comment.