File tree Expand file tree Collapse file tree 1 file changed +1
-5
lines changed
target_chains/solana/programs/pyth-solana-receiver/src Expand file tree Collapse file tree 1 file changed +1
-5
lines changed Original file line number Diff line number Diff line change @@ -575,18 +575,14 @@ fn calculate_twap(start_msg: &TwapMessage, end_msg: &TwapMessage) -> Result<(i64
575575
576576 // Calculate down_slots_ratio as an integer between 0 and 1_000_000
577577 // A value of 1_000_000 means all slots were missed and 0 means no slots were missed.
578- let total_slots = end_msg
579- . publish_slot
580- . checked_sub ( start_msg. publish_slot )
581- . ok_or ( ReceiverError :: TwapCalculationOverflow ) ?;
582578 let total_down_slots = end_msg
583579 . num_down_slots
584580 . checked_sub ( start_msg. num_down_slots )
585581 . ok_or ( ReceiverError :: TwapCalculationOverflow ) ?;
586582 let down_slots_ratio = total_down_slots
587583 . checked_mul ( 1_000_000 )
588584 . ok_or ( ReceiverError :: TwapCalculationOverflow ) ?
589- . checked_div ( total_slots )
585+ . checked_div ( slot_diff )
590586 . ok_or ( ReceiverError :: TwapCalculationOverflow ) ?;
591587 // down_slots_ratio is a number in [0, 1_000_000], so we only need 32 unsigned bits
592588 let down_slots_ratio =
You can’t perform that action at this time.
0 commit comments