Skip to content
Open
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
8 changes: 5 additions & 3 deletions crates/core/providers-solana/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,11 @@ impl BlockStreamer for Client {
// Auto mode: skip archive for recent slots, use it for historical data
match self.main_rpc_client.get_slot(self.metrics.clone()).await {
Ok(current_slot) => {
let threshold = current_slot.saturating_sub(10_000);
let skip_archive = start > threshold;
// The CAR archive is usually 1-2 epochs behind the latest block,
// so a threshold of 3 epochs should be safe.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you want a configuration here in case you need to experiment with it at run time?

let skip_archive = current_slot
.checked_sub(3 * solana_clock::DEFAULT_SLOTS_PER_EPOCH)
.is_some_and(|threshold| start > threshold);

if skip_archive {
tracing::info!(
Expand All @@ -261,7 +264,6 @@ impl BlockStreamer for Client {
tracing::info!(
start_slot = start,
current_slot = current_slot,
threshold,
"Using archive mode (historical slots, use_archive = auto)"
);
}
Expand Down
Loading