Skip to content

Commit

Permalink
Merge pull request #669 from helium/andymck/service-provider-rewards-…
Browse files Browse the repository at this point in the history
…plus-unallocated

Add support for unallocated MOBILE rewards
  • Loading branch information
andymck authored Jan 5, 2024
2 parents 06a515e + bafe0c8 commit e1aae41
Show file tree
Hide file tree
Showing 7 changed files with 496 additions and 196 deletions.
5 changes: 5 additions & 0 deletions file_store/src/cli/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ impl Cmd {
"operation_mode": msg.report.operation_mode,
"location_validation_timestamp": msg.report.location_validation_timestamp,
});
// print_json(&msg)?;
print_json(&json)?;
}
FileType::CellSpeedtest => {
Expand Down Expand Up @@ -230,6 +231,10 @@ impl Cmd {
"service_provider": reward.service_provider_id,
"amount": reward.amount,
}))?,
Some(Reward::UnallocatedReward(reward)) => print_json(&json!({
"unallocated_reward_type": reward.reward_type,
"amount": reward.amount,
}))?,
_ => (),
}
}
Expand Down
6 changes: 3 additions & 3 deletions mobile_verifier/src/cli/reward_from_db.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
heartbeats::HeartbeatReward,
reward_shares::{get_scheduled_tokens_for_poc_and_dc, CoveragePoints},
reward_shares::{get_scheduled_tokens_for_poc, CoveragePoints},
speedtests_average::SpeedtestAverages,
Settings,
};
Expand Down Expand Up @@ -30,7 +30,7 @@ impl Cmd {

tracing::info!("Rewarding shares from the following time range: {start} to {end}");
let epoch = start..end;
let expected_rewards = get_scheduled_tokens_for_poc_and_dc(epoch.end - epoch.start);
let expected_rewards = get_scheduled_tokens_for_poc(epoch.end - epoch.start);

let (shutdown_trigger, _shutdown_listener) = triggered::trigger();
let pool = settings.database.connect(env!("CARGO_PKG_NAME")).await?;
Expand All @@ -48,7 +48,7 @@ impl Cmd {
let radio_rewards = reward_shares
.into_rewards(Decimal::ZERO, &epoch)
.ok_or(anyhow::anyhow!("no rewardable events"))?;
for reward in radio_rewards {
for (_reward_amount, reward) in radio_rewards {
if let Some(proto::mobile_reward_share::Reward::RadioReward(proto::RadioReward {
hotspot_key,
poc_reward,
Expand Down
Loading

0 comments on commit e1aae41

Please sign in to comment.