diff --git a/api/src/lib.rs b/api/src/lib.rs index a64187f..b4c2f23 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -10,4 +10,4 @@ pub(crate) use ore_utils as utils; use solana_program::declare_id; // declare_id!("mineRHF5r6S7HyD9SppBfVMXMavDkJsxwGesEvxZr2A"); -declare_id!("5vBA1LwxxiobFsVHZeHgWS5mdUTjRDjo7e7xSFk25LVr"); +declare_id!("EarRpm6FCvs7biAjL1F6yTugqUvLoXtYUvPKb2tHNh8w"); diff --git a/program/src/mine.rs b/program/src/mine.rs index 4fec55b..9e1a90e 100644 --- a/program/src/mine.rs +++ b/program/src/mine.rs @@ -97,6 +97,7 @@ pub fn process_mine<'a, 'info>( .base_reward_rate .checked_mul(2u64.checked_pow(difficulty).unwrap()) .unwrap(); + sol_log(&format!("reward: {}", reward)); // Apply staking multiplier. // If user has greater than or equal to the max stake on the network, they receive 2x multiplier. @@ -123,16 +124,16 @@ pub fn process_mine<'a, 'info>( // Apply liveness penalty. let t_liveness = t_target.saturating_add(TOLERANCE); + let ratio = reward + .checked_mul(t.checked_sub(t_liveness).unwrap() as u64) + .unwrap() + .checked_div(ONE_MINUTE as u64) + .unwrap(); + sol_log(&format!("ratio: {}", ratio)); if t.gt(&t_liveness) { - reward = reward - .checked_sub( - reward - .checked_mul(t.checked_sub(t_liveness).unwrap() as u64) - .unwrap() - .checked_div(ONE_MINUTE as u64) - .unwrap(), - ) - .unwrap(); + let reward_diff = reward.checked_sub(ratio).unwrap(); + sol_log(&format!("reward_diff: {}", reward_diff)); + reward = reward_diff; } // Limit payout amount to whatever is left in the bus