Skip to content

Commit

Permalink
feat: use different key for payment forward
Browse files Browse the repository at this point in the history
  • Loading branch information
maqi authored and joshuef committed May 21, 2024
1 parent a55cfab commit 3f89f68
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/memcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ jobs:

- name: Audit from genesis to collect entire spend DAG and dump to a dot file
run: |
./target/release/safe --log-output-dest=data-dir wallet audit --dot --sk-str 17f659c8d3f19b58f140bfe33c97a65a9c60e4383a2628c406f0414ce47b0572 > spend_dag_and_statistics.txt
./target/release/safe --log-output-dest=data-dir wallet audit --dot --sk-str 49113d2083f57a976076adbe85decb75115820de1e6e74b47e0429338cef124a > spend_dag_and_statistics.txt
echo "=============================================================================="
cat spend_dag_and_statistics.txt
env:
Expand Down
4 changes: 2 additions & 2 deletions sn_node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use sn_protocol::{
messages::{ChunkProof, Cmd, CmdResponse, Query, QueryResponse, Request, Response},
NetworkAddress, PrettyPrintRecordKey,
};
use sn_transfers::{HotWallet, MainPubkey, MainSecretKey, NanoTokens, NETWORK_ROYALTIES_PK};
use sn_transfers::{HotWallet, MainPubkey, MainSecretKey, NanoTokens, PAYMENT_FORWARD_PK};
use std::{
net::SocketAddr,
path::PathBuf,
Expand Down Expand Up @@ -769,7 +769,7 @@ impl Node {
let mut wallet = HotWallet::load_from(&network.root_dir_path)?;
let balance = wallet.balance();

let payee = vec![(balance, *NETWORK_ROYALTIES_PK)];
let payee = vec![(balance, *PAYMENT_FORWARD_PK)];

spend_requests.extend(wallet.prepare_forward_signed_spend(payee, forward_reason)?);
}
Expand Down
2 changes: 1 addition & 1 deletion sn_transfers/src/cashnotes/spend_reason.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl SpendReason {
}

pub fn create_reward_tracking_reason(input_str: &str) -> Result<Self> {
let input_pk = crate::NETWORK_ROYALTIES_PK.public_key();
let input_pk = crate::PAYMENT_FORWARD_PK.public_key();
Ok(Self::BetaRewardTracking(DiscordNameCipher::create(
input_str, input_pk,
)?))
Expand Down
11 changes: 11 additions & 0 deletions sn_transfers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ use lazy_static::lazy_static;
const FOUNDATION_PK_STR: &str = "8f73b97377f30bed96df1c92daf9f21b4a82c862615439fab8095e68860a5d0dff9f97dba5aef503a26c065e5cb3c7ca"; // DevSkim: ignore DS173237
/// Public key where network royalties payments are expected to be made to.
const NETWORK_ROYALTIES_STR: &str = "b4243ec9ceaec374ef992684cd911b209758c5de53d1e406b395bc37ebc8ce50e68755ea6d32da480ae927e1af4ddadb"; // DevSkim: ignore DS173237
/// Public key where payment forward to be targeted.
const PAYMENT_FORWARD_STR: &str = "a585839f0502713a0ed6a327f3bd0c301f9e8fe298c93dd00ed7869d8e6804244f0d3014e90df45cd344a7ccd702865c"; // DevSkim: ignore DS173237

lazy_static! {
pub static ref FOUNDATION_PK: MainPubkey = {
Expand All @@ -64,6 +66,15 @@ lazy_static! {
};
}

lazy_static! {
pub static ref PAYMENT_FORWARD_PK: MainPubkey = {
match MainPubkey::from_hex(PAYMENT_FORWARD_STR) {
Ok(pk) => pk,
Err(err) => panic!("Failed to parse hard-coded payment forward PK: {err:?}"),
}
};
}

// re-export crates used in our public API
pub use bls::{self, rand, Ciphertext, Signature};

Expand Down

0 comments on commit 3f89f68

Please sign in to comment.