|
2 | 2 | crate::{ |
3 | 3 | accounts::{ |
4 | 4 | PriceAccount, |
5 | | - PriceInfo, |
6 | 5 | PythOracleSerialize, |
7 | 6 | UPD_PRICE_WRITE_SEED, |
8 | 7 | }, |
@@ -129,7 +128,6 @@ pub fn upd_price( |
129 | 128 | let clock = Clock::from_account_info(clock_account)?; |
130 | 129 |
|
131 | 130 | let mut publisher_index: usize = 0; |
132 | | - let latest_aggregate_price: PriceInfo; |
133 | 131 | let slots_since_last_update: u64; |
134 | 132 | let noninitial_price_update_after_program_upgrade: bool; |
135 | 133 |
|
@@ -162,10 +160,6 @@ pub fn upd_price( |
162 | 160 | noninitial_price_update_after_program_upgrade = |
163 | 161 | price_data.prev_twap_.denom_ == 0 && slots_since_last_update == 0; |
164 | 162 |
|
165 | | - // We assign the current aggregate price to latest_aggregate_price before calling c_upd_aggregate because |
166 | | - // c_upd_aggregate directly modifies the memory of price_data.agg_ to update its values. This is crucial for |
167 | | - // comparisons or operations that rely on the aggregate price state before the update such as slots_since_last_update. |
168 | | - latest_aggregate_price = price_data.agg_; |
169 | 163 | let latest_publisher_price = price_data.comp_[publisher_index].latest_; |
170 | 164 |
|
171 | 165 | // Check that publisher is publishing a more recent price |
@@ -196,7 +190,7 @@ pub fn upd_price( |
196 | 190 | } |
197 | 191 |
|
198 | 192 | // If the price update is the first in the slot and the aggregate is trading, update the previous slot, price, conf, and timestamp. |
199 | | - if slots_since_last_update > 0 && latest_aggregate_price.status_ == PC_STATUS_TRADING { |
| 193 | + if slots_since_last_update > 0 && price_data.agg_.status_ == PC_STATUS_TRADING { |
200 | 194 | price_data.prev_slot_ = price_data.agg_.pub_slot_; |
201 | 195 | price_data.prev_price_ = price_data.agg_.price_; |
202 | 196 | price_data.prev_conf_ = price_data.agg_.conf_; |
|
0 commit comments