Skip to content

Commit 6897096

Browse files
committed
pushing work for now
1 parent 9e144ff commit 6897096

File tree

1 file changed

+19
-17
lines changed
  • target_chains/stylus/contracts/pyth-receiver/src

1 file changed

+19
-17
lines changed

target_chains/stylus/contracts/pyth-receiver/src/lib.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -300,30 +300,32 @@ impl PythReceiver {
300300

301301
pub fn parse_price_feed_updates_with_config(
302302
&mut self,
303-
update_data: Vec<u8>,
303+
update_data: Vec<Vec<u8>>,
304304
price_ids: Vec<[u8; 32]>,
305305
min_allowed_publish_time: u64,
306306
max_allowed_publish_time: u64,
307307
check_uniqueness: bool,
308308
check_update_data_is_minimal: bool,
309309
store_updates_if_fresh: bool,
310310
) -> Result<Vec<PriceInfoReturn>, PythReceiverError> {
311-
let price_pairs;
312-
if store_updates_if_fresh {
313-
price_pairs = self.update_price_feeds_internal(
314-
update_data,
315-
price_ids.clone(),
316-
min_allowed_publish_time,
317-
max_allowed_publish_time,
318-
check_uniqueness,
319-
)?;
320-
} else {
321-
price_pairs = self.parse_price_feed_updates_internal(
322-
update_data,
323-
min_allowed_publish_time,
324-
max_allowed_publish_time,
325-
check_uniqueness,
326-
)?;
311+
let all_parsed_price_pairs = Vec::new();
312+
for data in &update_data {
313+
if store_updates_if_fresh {
314+
all_parsed_price_pairs.extend(self.update_price_feeds_internal(
315+
data,
316+
price_ids.clone(),
317+
min_allowed_publish_time,
318+
max_allowed_publish_time,
319+
check_uniqueness,
320+
)?);
321+
} else {
322+
all_parsed_price_pairs.extend(self.parse_price_feed_updates_internal(
323+
data,
324+
min_allowed_publish_time,
325+
max_allowed_publish_time,
326+
check_uniqueness,
327+
)?);
328+
}
327329
}
328330

329331
if check_update_data_is_minimal && price_ids.len() != price_pairs.len() {

0 commit comments

Comments
 (0)