Skip to content

Commit

Permalink
small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscar-Pepper committed Jan 17, 2025
1 parent 1372b69 commit 9339488
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 4 additions & 2 deletions zingo-sync/src/client/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ async fn get_latest_block(

Ok(client.get_latest_block(request).await.unwrap().into_inner())
}

async fn get_block_range(
client: &mut CompactTxStreamerClient<zingo_netutils::UnderlyingService>,
block_range: Range<BlockHeight>,
Expand All @@ -183,9 +184,8 @@ async fn get_block_range(
hash: vec![],
}),
});
let block_stream = client.get_block_range(request).await.unwrap().into_inner();

Ok(block_stream)
Ok(client.get_block_range(request).await.unwrap().into_inner())
}

async fn get_subtree_roots(
Expand All @@ -199,12 +199,14 @@ async fn get_subtree_roots(
shielded_protocol,
max_entries,
};

Ok(client
.get_subtree_roots(request)
.await
.unwrap()
.into_inner())
}

async fn get_tree_state(
client: &mut CompactTxStreamerClient<zingo_netutils::UnderlyingService>,
block_height: BlockHeight,
Expand Down
3 changes: 1 addition & 2 deletions zingo-sync/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ pub(crate) mod spend;
pub(crate) mod state;
pub(crate) mod transparent;

// TODO: move parameters to config module
const VERIFY_BLOCK_RANGE_SIZE: u32 = 10;
const MAX_VERIFICATION_WINDOW: u32 = 100;

/// Syncs a wallet to the latest state of the blockchain
pub async fn sync<P, W>(
client: CompactTxStreamerClient<zingo_netutils::UnderlyingService>, // TODO: change underlying service for generic
client: CompactTxStreamerClient<zingo_netutils::UnderlyingService>,
consensus_parameters: &P,
wallet: Arc<Mutex<W>>,
) -> Result<(), SyncError>
Expand Down
5 changes: 0 additions & 5 deletions zingo-sync/src/sync/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ where
}

/// Returns the locators for a given `block_range` from the wallet's [`crate::primitives::SyncState`]
// TODO: unit test high priority
fn find_locators(sync_state: &SyncState, block_range: &Range<BlockHeight>) -> BTreeSet<Locator> {
sync_state
.locators()
Expand All @@ -76,8 +75,6 @@ fn find_locators(sync_state: &SyncState, block_range: &Range<BlockHeight>) -> BT
.collect()
}

// TODO: remove locators after range is scanned

/// Update scan ranges for scanning
pub(super) async fn update_scan_ranges(
consensus_parameters: &impl consensus::Parameters,
Expand Down Expand Up @@ -148,8 +145,6 @@ fn reset_scan_ranges(sync_state: &mut SyncState) -> Result<(), ()> {
set_scan_priority(sync_state, scan_range.block_range(), ScanPriority::Verify).unwrap();
}

// TODO: determine OpenAdjacent priority ranges from the end block of previous ChainTip ranges

Ok(())
}

Expand Down

0 comments on commit 9339488

Please sign in to comment.