test-validator: hold rent constant with --slots-per-epoch
(#18317)
(cherry picked from commit 02b14caa5f
)
Co-authored-by: Trent Nelson <trent@solana.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
//! configuration for network rent
|
||||
use crate::clock::DEFAULT_SLOTS_PER_EPOCH;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Clone, Copy, Debug, AbiExample)]
|
||||
@@ -81,6 +82,17 @@ impl Rent {
|
||||
..Rent::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_slots_per_epoch(slots_per_epoch: u64) -> Self {
|
||||
let ratio = slots_per_epoch as f64 / DEFAULT_SLOTS_PER_EPOCH as f64;
|
||||
let exemption_threshold = DEFAULT_EXEMPTION_THRESHOLD as f64 * ratio;
|
||||
let lamports_per_byte_year = (DEFAULT_LAMPORTS_PER_BYTE_YEAR as f64 / ratio) as u64;
|
||||
Self {
|
||||
lamports_per_byte_year,
|
||||
exemption_threshold,
|
||||
..Self::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Reference in New Issue
Block a user