2
2
use {
3
3
crate :: accounts:: {
4
4
PriceFeedMessage ,
5
- TwapMessage ,
6
5
UPD_PRICE_WRITE_SEED ,
7
6
} ,
8
7
solana_program:: instruction:: {
@@ -179,14 +178,21 @@ pub fn upd_price(
179
178
180
179
if aggregate_updated {
181
180
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 ;
187
181
}
182
+ }
183
+
184
+ let mut price_data = load_checked :: < PriceAccount > ( price_account, cmd_args. header . version ) ?;
188
185
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
+ }
190
196
if let Some ( accumulator_accounts) = maybe_accumulator_accounts {
191
197
if price_data. message_sent_ == 0 {
192
198
// Check that the oracle PDA is correctly configured for the program we are calling.
@@ -219,14 +225,12 @@ pub fn upd_price(
219
225
} ,
220
226
] ;
221
227
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
+ ] ;
230
234
231
235
// anchor discriminator for "global:put_all"
232
236
let discriminator: [ u8 ; 8 ] = [ 212 , 225 , 193 , 91 , 151 , 238 , 20 , 93 ] ;
@@ -248,9 +252,6 @@ pub fn upd_price(
248
252
}
249
253
}
250
254
251
-
252
- let mut price_data = load_checked :: < PriceAccount > ( price_account, cmd_args. header . version ) ?;
253
-
254
255
// Try to update the publisher's price
255
256
if is_component_update ( cmd_args) ? {
256
257
let status: u32 =
0 commit comments