diff --git a/Cargo.lock b/Cargo.lock index a78d739..50e201f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2761,7 +2761,7 @@ dependencies = [ [[package]] name = "pyth-agent" -version = "2.3.0" +version = "2.3.1" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index cfead40..00c3fc2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyth-agent" -version = "2.3.0" +version = "2.3.1" edition = "2021" [[bin]] diff --git a/src/agent/solana/exporter.rs b/src/agent/solana/exporter.rs index d4aeab8..08923d8 100644 --- a/src/agent/solana/exporter.rs +++ b/src/agent/solana/exporter.rs @@ -154,8 +154,8 @@ impl Default for Config { compute_unit_limit: 40000, compute_unit_price_micro_lamports: None, dynamic_compute_unit_pricing_enabled: false, - maximum_total_compute_fee_micro_lamports: 1_000_000_000_000, - maximum_slot_gap_for_dynamic_compute_unit_price: 25, + maximum_total_compute_fee_micro_lamports: 100_000_000_000, + maximum_slot_gap_for_dynamic_compute_unit_price: 30, } } } @@ -722,12 +722,20 @@ impl Exporter { let result = result_rx.await??; - // Calculate the maximum slot difference between aggregate slot and + // Calculate the maximum slot difference between the publisher latest slot and // current slot amongst all the accounts. Here, the aggregate slot is // used instead of the publishers latest update to avoid overpaying. let oldest_slot = result .values() - .map(|account| account.last_slot) + .flat_map(|account| { + account + .comp + .iter() + .filter(|c| c.publisher == publish_keypair.pubkey()) + .collect::>() + .get(0) + .map(|c| c.latest.pub_slot) + }) .min() .ok_or(anyhow!("No price accounts"))?;