Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get block range #87

Merged
merged 3 commits into from
Nov 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions zaino-serve/src/rpc/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,12 @@ impl CompactTxStreamer for GrpcClient {
));
}
};
if start > end {
let rev_order = if start > end {
(start, end) = (end, start);
}
true
} else {
false
};
Oscar-Pepper marked this conversation as resolved.
Show resolved Hide resolved
if end
< JsonRpcConnector::new(
self.zebrad_uri.clone(),
Expand All @@ -334,7 +337,12 @@ impl CompactTxStreamer for GrpcClient {
tokio::spawn(async move {
// NOTE: This timeout is so slow due to the blockcache not being implemented. This should be reduced to 30s once functionality is in place.
let timeout = timeout(std::time::Duration::from_secs(120), async {
for height in (start..=end).rev() {
for height in start..=end {
let height = if rev_order {
end - (height - start)
} else {
height
};
println!("[TEST] Fetching block at height: {}.", height);
match get_block_from_node(&zebrad_uri, &height).await {
Ok(block) => {
Expand Down Expand Up @@ -434,9 +442,12 @@ impl CompactTxStreamer for GrpcClient {
));
}
};
if start > end {
let rev_order = if start > end {
(start, end) = (end, start);
}
true
} else {
false
};
if end
< JsonRpcConnector::new(
self.zebrad_uri.clone(),
Expand All @@ -459,6 +470,11 @@ impl CompactTxStreamer for GrpcClient {
// NOTE: This timeout is so slow due to the blockcache not being implemented. This should be reduced to 30s once functionality is in place.
let timeout = timeout(std::time::Duration::from_secs(120), async {
for height in start..=end {
let height = if rev_order {
end - (height - start)
} else {
height
};
let compact_block = get_nullifiers_from_node(&zebrad_uri, &height).await;
match compact_block {
Ok(block) => {
Expand Down
Loading