Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: small tweak to get foundaiton cash #1823

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions resources/scripts/get-foundation-cash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@

# Suffix to append to the version. Passed as an argument to this script.
FOUNDATION_SERVER="$1"
PEER="$2"


# if doundation server not provided, exit
if [ -z "$FOUNDATION_SERVER" ]; then
echo "Please provide the foundation server IP address as an argument to this script"
exit 1
fi

scp root@$FOUNDATION_SERVER:/home/safe/.local/share/safe/test_faucet/wallet/foundation_disbursement.cash_note $TMPDIR/foundation.transfer
safe wallet receive $TMPDIR/foundation.transfer
# if doundation server not provided, exit
if [ -z "$PEER" ]; then
echo "Please provide the starting peer id an argument to this script"
exit 1
fi

scp root@$FOUNDATION_SERVER:/home/safe/.local/share/safe/test_faucet/wallet/foundation_disbursement.transfer $TMPDIR/foundation.transfer
safe --peer $2 wallet receive $TMPDIR/foundation.transfer --file
safe wallet balance
8 changes: 4 additions & 4 deletions sn_auditor/src/dag_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub const SPEND_DAG_SVG_FILENAME: &str = "spend_dag.svg";
/// Store a locally copy to restore on restart
pub const BETA_PARTICIPANTS_FILENAME: &str = "beta_participants.txt";

const REATTEMPT_INTERVAL: Duration = Duration::from_secs(3600);
const DAG_RECRAWL_INTERVAL: Duration = Duration::from_secs(60);
const SPENDS_PROCESSING_BUFFER_SIZE: usize = 4096;

/// Abstraction for the Spend DAG database
Expand Down Expand Up @@ -223,8 +223,8 @@ impl SpendDagDb {
let addrs_to_get = utxos_to_fetch.keys().cloned().collect::<BTreeSet<_>>();

if addrs_to_get.is_empty() {
debug!("Sleeping for {REATTEMPT_INTERVAL:?} until next re-attempt...");
tokio::time::sleep(REATTEMPT_INTERVAL).await;
debug!("Sleeping for {DAG_RECRAWL_INTERVAL:?} until next re-attempt...");
tokio::time::sleep(DAG_RECRAWL_INTERVAL).await;
continue;
}

Expand All @@ -241,7 +241,7 @@ impl SpendDagDb {
utxo_addresses.extend(
new_utxos
.into_iter()
.map(|a| (a, Instant::now() + REATTEMPT_INTERVAL)),
.map(|a| (a, Instant::now() + DAG_RECRAWL_INTERVAL)),
);

// write updates to local DAG and save to disk
Expand Down
6 changes: 3 additions & 3 deletions sn_auditor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::path::PathBuf;
use tiny_http::{Response, Server};

/// Backup the beta rewards in a timestamped json file
const BETA_REWARDS_BACKOUP_INTERVAL_SECS: u64 = 20 * 60;
const BETA_REWARDS_BACKUP_INTERVAL_SECS: u64 = 20 * 60;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
Expand Down Expand Up @@ -163,10 +163,10 @@ fn initialize_background_rewards_backup(dag: SpendDagDb) {
tokio::spawn(async move {
loop {
trace!(
"Sleeping for {BETA_REWARDS_BACKOUP_INTERVAL_SECS} seconds before next backup..."
"Sleeping for {BETA_REWARDS_BACKUP_INTERVAL_SECS} seconds before next backup..."
);
tokio::time::sleep(tokio::time::Duration::from_secs(
BETA_REWARDS_BACKOUP_INTERVAL_SECS,
BETA_REWARDS_BACKUP_INTERVAL_SECS,
))
.await;
println!("Backing up beta rewards...");
Expand Down
5 changes: 4 additions & 1 deletion sn_node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ impl Node {
PERIODIC_REPLICATION_INTERVAL_MAX_S / 2..PERIODIC_REPLICATION_INTERVAL_MAX_S,
);
let balance_forward_time = Duration::from_secs(balance_forward_interval);
debug!("BalanceForward interval set to {balance_forward_time:?}");
debug!(
"BalanceForward interval set to {balance_forward_time:?} to: {:?}",
PAYMENT_FORWARD_PK.to_hex(),
);

let mut balance_forward_interval = tokio::time::interval(balance_forward_time);
let _ = balance_forward_interval.tick().await; // first tick completes immediately
Expand Down
Loading