Skip to content

Commit 86bdade

Browse files
committed
refactor(apps/hermes): address feedbacks
1 parent 26fe00a commit 86bdade

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

apps/hermes/server/src/network/pythnet.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ use {
2727
solana_sdk::{
2828
account::Account, commitment_config::CommitmentConfig, pubkey::Pubkey, system_program,
2929
},
30-
std::{
31-
collections::{BTreeMap, HashSet},
32-
sync::Arc,
33-
time::Duration,
34-
},
30+
std::{collections::BTreeMap, sync::Arc, time::Duration},
3531
tokio::time::Instant,
3632
};
3733

@@ -247,10 +243,13 @@ where
247243

248244
// Wait for the crosschain price feed ids to be available in the state
249245
// This is to prune the price feeds that are not available crosschain yet (i.e. they are coming soon)
250-
let mut all_ids = HashSet::new();
246+
let mut all_ids;
251247
let mut retry_count = 0;
252-
while all_ids.is_empty() {
248+
loop {
253249
all_ids = Aggregates::get_price_feed_ids(state).await;
250+
if !all_ids.is_empty() {
251+
break;
252+
}
254253
tracing::info!("Waiting for price feed ids...");
255254
tokio::time::sleep(Duration::from_secs(retry_count + 1)).await;
256255
retry_count += 1;
@@ -280,6 +279,7 @@ async fn fetch_price_feeds_metadata(
280279
filters: Some(vec![RpcFilterType::Memcmp(Memcmp::new(
281280
0, // offset
282281
// Product account header: <magic:u32le:0xa1b2c3d4> <version:u32le:0x02> <account_type:u32le:0x02>
282+
// The string literal in hex::decode is represented as be (big endian).
283283
MemcmpEncodedBytes::Bytes(hex::decode("d4c3b2a10200000002000000").unwrap()),
284284
))]),
285285
account_config: RpcAccountInfoConfig {

0 commit comments

Comments
 (0)