Skip to content

Commit

Permalink
Make block index calls optional
Browse files Browse the repository at this point in the history
  • Loading branch information
sug0 committed Aug 1, 2024
1 parent 257f0cd commit 8353ef4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/apps_lib/src/client/masp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub async fn syncing<
))
})?;

dispatch_client!(IndexerMaspClient::new(client, url))?
dispatch_client!(IndexerMaspClient::new(client, url, true))?
} else {
display_line!(
io,
Expand Down
14 changes: 12 additions & 2 deletions crates/sdk/src/masp/shielded_sync/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,21 @@ impl RequestBuilderExt for reqwest::RequestBuilder {
impl IndexerMaspClient {
/// Create a new [`IndexerMaspClient`].
#[inline]
pub fn new(client: reqwest::Client, indexer_api: reqwest::Url) -> Self {
pub fn new(
client: reqwest::Client,
indexer_api: reqwest::Url,
using_block_index: bool,
) -> Self {
let shared = Arc::new(IndexerMaspClientShared {
indexer_api,
semaphore: Semaphore::new(MAX_CONCURRENT_REQUESTS),
block_index: init_once::InitOnce::new(),
block_index: {
let index = init_once::InitOnce::new();
if !using_block_index {
debug_assert!(index.try_init(|| None).is_some());
}
index
},
});
Self { client, shared }
}
Expand Down

0 comments on commit 8353ef4

Please sign in to comment.