Skip to content

Commit

Permalink
Merge pull request #561 from helium/jg/encoding-subscriber-id-rewards
Browse files Browse the repository at this point in the history
ensure mobile subscriber id is properly credited for mobile rewards
  • Loading branch information
jeffgrunewald authored Jun 30, 2023
2 parents 0f5d3f2 + d9b9c29 commit c4cc3ce
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions reward_index/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ license.workspace = true

[dependencies]
anyhow = {workspace = true}
bs58 = {workspace = true}
config = {workspace = true}
clap = {workspace = true}
thiserror = {workspace = true}
Expand Down
20 changes: 7 additions & 13 deletions reward_index/src/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,13 @@ impl Indexer {
},
r.dc_transfer_reward,
)),
Some(MobileReward::SubscriberReward(r)) => {
let key = match str::from_utf8(&r.subscriber_id) {
Ok(k) => k.to_string(),
Err(_e) => bail!("got an invalid subscriber id"),
};
Ok((
RewardKey {
key,
reward_type: RewardType::MobileSubscriber,
},
r.discovery_location_amount,
))
}
Some(MobileReward::SubscriberReward(r)) => Ok((
RewardKey {
key: bs58::encode(&r.subscriber_id).into_string(),
reward_type: RewardType::MobileSubscriber,
},
r.discovery_location_amount,
)),
_ => bail!("got an invalid reward share"),
}
}
Expand Down

0 comments on commit c4cc3ce

Please sign in to comment.