@@ -746,38 +746,40 @@ impl Exporter {
746
746
// used instead of the publishers latest update to avoid overpaying.
747
747
let oldest_slot = result
748
748
. values ( )
749
+ . filter ( |account| account. min_pub != 255 ) // Only consider live price accounts
749
750
. flat_map ( |account| {
750
751
account
751
752
. comp
752
753
. iter ( )
753
754
. find ( |c| c. publisher == publish_keypair. pubkey ( ) )
754
- . map ( |c| c. latest . pub_slot )
755
+ . map ( |c| c. latest . pub_slot . max ( account . agg . pub_slot ) )
755
756
} )
756
- . min ( )
757
- . ok_or ( anyhow ! ( "No price accounts" ) ) ?;
758
-
759
- let slot_gap = network_state. current_slot . saturating_sub ( oldest_slot) ;
760
-
761
- // Set the dynamic price exponentially based on the slot gap. If the max slot gap is
762
- // 25, on this number (or more) the maximum unit price is paid, and then on slot 24 it
763
- // is half of that and gets halved each lower slot. Given that we have max total
764
- // compute price of 10**12 and 250k compute units in one tx (12 updates) these are the
765
- // estimated prices based on slot gaps:
766
- // 25 (or more): 4_000_000
767
- // 20 : 125_000
768
- // 18 : 31_250
769
- // 15 : 3_906
770
- // 13 : 976
771
- // 10 : 122
772
- let exponential_price = maximum_unit_price
773
- >> self
774
- . config
775
- . maximum_slot_gap_for_dynamic_compute_unit_price
776
- . saturating_sub ( slot_gap) ;
777
-
778
- compute_unit_price_micro_lamports = compute_unit_price_micro_lamports
779
- . map ( |price| price. max ( exponential_price) )
780
- . or ( Some ( exponential_price) ) ;
757
+ . min ( ) ;
758
+
759
+ if let Some ( oldest_slot) = oldest_slot {
760
+ let slot_gap = network_state. current_slot . saturating_sub ( oldest_slot) ;
761
+
762
+ // Set the dynamic price exponentially based on the slot gap. If the max slot gap is
763
+ // 25, on this number (or more) the maximum unit price is paid, and then on slot 24 it
764
+ // is half of that and gets halved each lower slot. Given that we have max total
765
+ // compute price of 10**12 and 250k compute units in one tx (12 updates) these are the
766
+ // estimated prices based on slot gaps:
767
+ // 25 (or more): 4_000_000
768
+ // 20 : 125_000
769
+ // 18 : 31_250
770
+ // 15 : 3_906
771
+ // 13 : 976
772
+ // 10 : 122
773
+ let exponential_price = maximum_unit_price
774
+ >> self
775
+ . config
776
+ . maximum_slot_gap_for_dynamic_compute_unit_price
777
+ . saturating_sub ( slot_gap) ;
778
+
779
+ compute_unit_price_micro_lamports = compute_unit_price_micro_lamports
780
+ . map ( |price| price. max ( exponential_price) )
781
+ . or ( Some ( exponential_price) ) ;
782
+ }
781
783
}
782
784
783
785
if let Some ( compute_unit_price_micro_lamports) = compute_unit_price_micro_lamports {
0 commit comments