diff --git a/sn_auditor/src/dag_db.rs b/sn_auditor/src/dag_db.rs index f263c3b2dc..d287c1b81c 100644 --- a/sn_auditor/src/dag_db.rs +++ b/sn_auditor/src/dag_db.rs @@ -14,7 +14,9 @@ use color_eyre::eyre::{bail, eyre, Result}; use graphviz_rust::{cmd::Format, exec, parse, printer::PrinterContext}; use lazy_static::lazy_static; use serde::{Deserialize, Serialize}; -use sn_client::transfers::{Hash, NanoTokens, SignedSpend, SpendAddress}; +use sn_client::transfers::{ + Hash, NanoTokens, SignedSpend, SpendAddress, DEFAULT_PAYMENT_FORWARD_SK, +}; use sn_client::{Client, SpendDag, SpendDagGet}; use std::collections::{BTreeMap, BTreeSet}; use std::fmt::Write; @@ -356,8 +358,24 @@ impl SpendDagDb { .or_default() .insert((addr, amount)); } else { + // check with default key + if let Some(default_user_name_hash) = + 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:?}"); + println!("With default key, got forwarded reward {amount} from {user_name} of {amount} at {addr:?}"); + beta_tracking + .forwarded_payments + .entry(user_name.to_owned()) + .or_default() + .insert((addr, amount)); + return; + } + } + warn!("Found a forwarded reward {amount} for an unknown participant at {addr:?}: {user_name_hash:?}"); - eprintln!("Found a forwarded reward {amount} for an unknown participant at {addr:?}: {user_name_hash:?}"); + println!("Found a forwarded reward {amount} for an unknown participant at {addr:?}: {user_name_hash:?}"); beta_tracking .forwarded_payments .entry(format!("unknown participant: {user_name_hash:?}")) diff --git a/sn_transfers/src/lib.rs b/sn_transfers/src/lib.rs index 2224b0e1c4..0130776689 100644 --- a/sn_transfers/src/lib.rs +++ b/sn_transfers/src/lib.rs @@ -37,6 +37,7 @@ pub use wallet::{ QUOTE_EXPIRATION_SECS, WALLET_DIR_NAME, }; +use bls::SecretKey; use lazy_static::lazy_static; /// The following PKs shall be updated to match its correspondent SKs before the formal release @@ -47,6 +48,9 @@ const DEFAULT_FOUNDATION_PK_STR: &str = "8f73b97377f30bed96df1c92daf9f21b4a82c86 const DEFAULT_NETWORK_ROYALTIES_STR: &str = "b4243ec9ceaec374ef992684cd911b209758c5de53d1e406b395bc37ebc8ce50e68755ea6d32da480ae927e1af4ddadb"; // DevSkim: ignore DS173237 /// Public key where payment forward to be targeted. const DEFAULT_PAYMENT_FORWARD_STR: &str = "a585839f0502713a0ed6a327f3bd0c301f9e8fe298c93dd00ed7869d8e6804244f0d3014e90df45cd344a7ccd702865c"; // DevSkim: ignore DS173237 +/// Default secrect key where payment forward to be targeted, for backward compatible purpose only. +const DEFAULT_PAYMENT_FORWARD_SK_STR: &str = + "49113d2083f57a976076adbe85decb75115820de1e6e74b47e0429338cef124a"; // DevSkim: ignore DS173237 lazy_static! { pub static ref FOUNDATION_PK: MainPubkey = { @@ -126,6 +130,12 @@ lazy_static! { Err(err) => panic!("Failed to parse payment forward PK: {err:?}"), } }; + pub static ref DEFAULT_PAYMENT_FORWARD_SK: SecretKey = { + match SecretKey::from_hex(DEFAULT_PAYMENT_FORWARD_SK_STR) { + Ok(sk) => sk, + Err(err) => panic!("Failed to parse default payment forward SK: {err:?}"), + } + }; } // re-export crates used in our public API