Skip to content

Commit

Permalink
feat(auditor): decrypt discord_id with default key
Browse files Browse the repository at this point in the history
  • Loading branch information
maqi authored and joshuef committed Jul 17, 2024
1 parent 550bfd4 commit 2f4568e
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions sn_auditor/src/dag_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,17 +444,32 @@ impl SpendDagDb {
}
beta_tracking.total_royalties.extend(royalties);

let addr = spend.address();
let amount = spend.spend.amount;

// check for beta rewards reason
let user_name_hash = match spend.reason().get_sender_hash(sk) {
Some(n) => n,
None => {
return;
if let Some(default_user_name_hash) =
spend.reason().get_sender_hash(&DEFAULT_PAYMENT_FORWARD_SK)
{
warn!("With default key, got forwarded reward of {amount} at {addr:?}");
println!("With default key, got forwarded reward of {amount} at {addr:?}");
default_user_name_hash
} else {
warn!(
"Can't descrypt discord_id from {addr:?} with compile key nor default key"
);
println!(
"Can't descrypt discord_id from {addr:?} with compile key nor default key"
);
return;
}
}
};

// add to local rewards
let addr = spend.address();
let amount = spend.spend.amount;
let beta_participants_read = self.beta_participants.read().await;

if let Some(user_name) = beta_participants_read.get(&user_name_hash) {
Expand All @@ -470,7 +485,8 @@ impl SpendDagDb {
spend.reason().get_sender_hash(&DEFAULT_PAYMENT_FORWARD_SK)
{
if let Some(user_name) = beta_participants_read.get(&default_user_name_hash) {
warn!("With default key, got forwarded reward {amount} from {user_name} of {amount} at {addr:?}");
warn!("With default key, got forwarded reward from {user_name} of {amount} at {addr:?}");
println!("With default key, got forwarded reward from {user_name} of {amount} at {addr:?}");
beta_tracking
.forwarded_payments
.entry(user_name.to_owned())
Expand Down

0 comments on commit 2f4568e

Please sign in to comment.