Minor variable name cleanup

This commit is contained in:
Michael Vines 2020-10-08 13:44:18 -07:00
parent 8f5431551e
commit 3a04026599
2 changed files with 6 additions and 6 deletions

View File

@ -735,7 +735,7 @@ pub fn process_get_block(rpc_client: &RpcClient, _config: &CliConfig, slot: Slot
" - -".to_string() " - -".to_string()
} else { } else {
format!( format!(
"◎{:<12.4} {:>13.4}%", "◎{:<12.4} {:>13.9}%",
lamports_to_sol(reward.post_balance), lamports_to_sol(reward.post_balance),
reward.lamports.abs() as f64 reward.lamports.abs() as f64
/ (reward.post_balance as f64 - reward.lamports as f64) / (reward.post_balance as f64 - reward.lamports as f64)

View File

@ -29,7 +29,7 @@ use solana_client::{
use solana_remote_wallet::remote_wallet::RemoteWalletManager; use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::{ use solana_sdk::{
account_utils::StateMut, account_utils::StateMut,
clock::{Clock, Epoch, Slot, UnixTimestamp}, clock::{Clock, Epoch, Slot, UnixTimestamp, SECONDS_PER_DAY},
message::Message, message::Message,
pubkey::Pubkey, pubkey::Pubkey,
system_instruction::SystemError, system_instruction::SystemError,
@ -1620,13 +1620,13 @@ pub(crate) fn fetch_epoch_rewards(
let previous_epoch_rewards = first_confirmed_block.rewards; let previous_epoch_rewards = first_confirmed_block.rewards;
if let Some((effective_slot, epoch_end_time, epoch_rewards)) = epoch_info { if let Some((effective_slot, epoch_end_time, epoch_rewards)) = epoch_info {
let wall_clock_epoch_duration = let wallclock_epoch_duration =
{ Local.timestamp(epoch_end_time, 0) - Local.timestamp(epoch_start_time, 0) } { Local.timestamp(epoch_end_time, 0) - Local.timestamp(epoch_start_time, 0) }
.to_std()? .to_std()?
.as_secs_f64(); .as_secs_f64();
const SECONDS_PER_YEAR: f64 = (24 * 60 * 60 * 356) as f64; let wallclock_epochs_per_year =
let percent_of_year = SECONDS_PER_YEAR / wall_clock_epoch_duration; (SECONDS_PER_DAY * 356) as f64 / wallclock_epoch_duration;
if let Some(reward) = epoch_rewards if let Some(reward) = epoch_rewards
.into_iter() .into_iter()
@ -1642,7 +1642,7 @@ pub(crate) fn fetch_epoch_rewards(
amount: reward.lamports.abs() as u64, amount: reward.lamports.abs() as u64,
post_balance: reward.post_balance, post_balance: reward.post_balance,
percent_change: balance_increase_percent, percent_change: balance_increase_percent,
apr: balance_increase_percent * percent_of_year, apr: balance_increase_percent * wallclock_epochs_per_year,
}); });
} }
} }