Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/state_listeners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::sync::{Arc, RwLock};
use std::time::Duration;
use tokio_util::sync::CancellationToken;
use tracing::info;
use crate::tx_senders::constants::SLOT_ERROR_THRESHOLD;

pub struct ChainListener {
pub current_slot: Arc<AtomicU64>,
Expand Down Expand Up @@ -72,9 +73,15 @@ impl ChainListener {
slot = stream.next() => slot,
} {
if let SlotUpdate::FirstShredReceived { slot, .. } = slot {
if slot > current_slot.load(Ordering::Relaxed) + SLOT_ERROR_THRESHOLD {
continue
}
current_slot.store(slot, Ordering::Relaxed);
}
if let SlotUpdate::Completed { slot, .. } = slot {
if slot > current_slot.load(Ordering::Relaxed) + SLOT_ERROR_THRESHOLD {
continue
}
current_slot.store(slot + 1, Ordering::Relaxed);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/tx_senders/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ pub const JITO_RPC_URL: &str = "https://mainnet.block-engine.jito.wtf:443/api/v1

pub const NOZOMI_TIP: &str = "TEMPaMeCRFAS9EKF53Jd6KpHxgL47uWLcpFArU1Fanq";
pub const MIN_TIP_AMOUNT: u64 = 1_000_000;

pub const SLOT_ERROR_THRESHOLD: u64 = 5;