22use {
33 crate :: accounts:: {
44 PriceFeedMessage ,
5- TwapMessage ,
65 UPD_PRICE_WRITE_SEED ,
76 } ,
87 solana_program:: instruction:: {
@@ -179,14 +178,21 @@ pub fn upd_price(
179178
180179 if aggregate_updated {
181180 price_data. update_price_cumulative ( ) ?;
182- // We want to send a message every time the aggregate price updates. However, during the migration,
183- // not every publisher will necessarily provide the accumulator accounts. The message_sent_ flag
184- // ensures that after every aggregate update, the next publisher who provides the accumulator accounts
185- // will send the message.
186- price_data. message_sent_ = 0 ;
187181 }
182+ }
183+
184+ let mut price_data = load_checked :: < PriceAccount > ( price_account, cmd_args. header . version ) ?;
188185
189- #[ cfg( feature = "pythnet" ) ]
186+
187+ #[ cfg( feature = "pythnet" ) ]
188+ {
189+ // We want to send a message every time the aggregate price updates. However, during the migration,
190+ // not every publisher will necessarily provide the accumulator accounts. The message_sent_ flag
191+ // ensures that after every aggregate update, the next publisher who provides the accumulator accounts
192+ // will send the message.
193+ if aggregate_updated {
194+ price_data. message_sent_ = 0 ;
195+ }
190196 if let Some ( accumulator_accounts) = maybe_accumulator_accounts {
191197 if price_data. message_sent_ == 0 {
192198 // Check that the oracle PDA is correctly configured for the program we are calling.
@@ -219,14 +225,12 @@ pub fn upd_price(
219225 } ,
220226 ] ;
221227
222- let message = vec ! [
223- PriceFeedMessage :: from_price_account( price_account. key, & price_data)
224- . as_bytes( )
225- . to_vec( ) ,
226- TwapMessage :: from_price_account( price_account. key, & price_data)
227- . as_bytes( )
228- . to_vec( ) ,
229- ] ;
228+ let message =
229+ vec ! [
230+ PriceFeedMessage :: from_price_account( price_account. key, & price_data)
231+ . as_bytes( )
232+ . to_vec( ) ,
233+ ] ;
230234
231235 // anchor discriminator for "global:put_all"
232236 let discriminator: [ u8 ; 8 ] = [ 212 , 225 , 193 , 91 , 151 , 238 , 20 , 93 ] ;
@@ -248,9 +252,6 @@ pub fn upd_price(
248252 }
249253 }
250254
251-
252- let mut price_data = load_checked :: < PriceAccount > ( price_account, cmd_args. header . version ) ?;
253-
254255 // Try to update the publisher's price
255256 if is_component_update ( cmd_args) ? {
256257 let status: u32 =
0 commit comments