Skip to content

Commit 84b5011

Browse files
committed
check feed id after pyth pull atomic update
1 parent e25367d commit 84b5011

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

programs/drift/src/instructions/pyth_pull_oracle.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ pub fn handle_post_multi_pyth_pull_oracle_updates_atomic<'c: 'info, 'info>(
182182
},
183183
)?;
184184

185+
let price_feed_account_data = account.try_borrow_data()?;
186+
let price_feed_account = PriceUpdateV2::try_deserialize(&mut &price_feed_account_data[..])?;
187+
validate!(
188+
price_feed_account.price_message.feed_id == feed_id,
189+
ErrorCode::OraclePriceFeedMessageMismatch
190+
)?;
191+
185192
msg!(
186193
"Posting new update. current ts {} < next ts {}",
187194
current_timestamp,

0 commit comments

Comments
 (0)