consolidate constants related to time for future refactoring (#14440)

This commit is contained in:
Jeff Washington (jwash)
2021-01-07 09:49:24 -06:00
committed by GitHub
parent 3fc7362486
commit 938d482135
8 changed files with 12 additions and 28 deletions

View File

@ -25,6 +25,7 @@ pub const DEFAULT_SLOTS_PER_EPOCH: u64 = 2 * TICKS_PER_DAY / DEFAULT_TICKS_PER_S
// leader schedule is governed by this
pub const NUM_CONSECUTIVE_LEADER_SLOTS: u64 = 4;
pub const DEFAULT_S_PER_SLOT: f64 = DEFAULT_TICKS_PER_SLOT as f64 / DEFAULT_TICKS_PER_SECOND as f64;
pub const DEFAULT_MS_PER_SLOT: u64 = 1_000 * DEFAULT_TICKS_PER_SLOT / DEFAULT_TICKS_PER_SECOND;
/// The time window of recent block hash values that the bank will track the signatures

View File

@ -1,4 +1,4 @@
use crate::clock::{DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT};
use crate::clock::DEFAULT_MS_PER_SLOT;
use crate::message::Message;
use crate::secp256k1_program;
use log::*;
@ -87,8 +87,7 @@ pub struct FeeRateGovernor {
}
pub const DEFAULT_TARGET_LAMPORTS_PER_SIGNATURE: u64 = 10_000;
pub const DEFAULT_TARGET_SIGNATURES_PER_SLOT: u64 =
50_000 * DEFAULT_TICKS_PER_SLOT / DEFAULT_TICKS_PER_SECOND;
pub const DEFAULT_TARGET_SIGNATURES_PER_SLOT: u64 = 50 * DEFAULT_MS_PER_SLOT;
// Percentage of tx fees to burn
pub const DEFAULT_BURN_PERCENT: u8 = 50;

View File

@ -142,8 +142,7 @@ mod tests {
use crate::{clock::*, sysvar::Sysvar};
const SECONDS_PER_YEAR: f64 = 365.242_199 * 24.0 * 60.0 * 60.0;
const SLOTS_PER_YEAR: f64 =
SECONDS_PER_YEAR / (DEFAULT_TICKS_PER_SLOT as f64 / DEFAULT_TICKS_PER_SECOND as f64);
const SLOTS_PER_YEAR: f64 = SECONDS_PER_YEAR / DEFAULT_S_PER_SLOT;
let rent = Rent::default();
panic!(