Skip to content

Commit adf60e2

Browse files
authored
Abehjati/rename max slot difference to valid slot period (#21)
* rename to valid_slot_period * Update doc
1 parent 18c9ca6 commit adf60e2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pyth-sdk-solana/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ pub use pyth_sdk::{
1616
ProductIdentifier,
1717
};
1818

19-
/// Maximum acceptable slot difference before price is considered to be stale.
20-
pub const MAX_SLOT_DIFFERENCE: u64 = 25;
19+
/// Maximum valid slot period before price is considered to be stale.
20+
pub const VALID_SLOT_PERIOD: u64 = 25;
2121

2222
/// Loads Pyth Price from the raw byte value of a Solana account.
2323
pub fn load_price(data: &[u8]) -> Result<Price, PythError> {

pyth-sdk-solana/src/state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use solana_program::{
2727
};
2828

2929
#[cfg(target_arch = "bpf")]
30-
use crate::MAX_SLOT_DIFFERENCE;
30+
use crate::VALID_SLOT_PERIOD;
3131

3232
use crate::PythError;
3333

@@ -339,7 +339,7 @@ impl PriceAccount {
339339

340340
#[cfg(target_arch = "bpf")]
341341
if matches!(status, PriceStatus::Trading)
342-
&& Clock::get().unwrap().slot - self.agg.pub_slot > MAX_SLOT_DIFFERENCE
342+
&& Clock::get().unwrap().slot - self.agg.pub_slot > VALID_SLOT_PERIOD
343343
{
344344
status = PriceStatus::Unknown;
345345
}

0 commit comments

Comments
 (0)