Skip to content

Commit 615c8e1

Browse files
authored
fix: include indexer status in candidate block range (#717)
1 parent 3187fec commit 615c8e1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

graph-gateway/src/client_query.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,8 @@ fn prepare_candidate(
566566
// range. This is to compensate for the gateway's lack of knowledge about which blocks
567567
// indexers have responded with already. All else being equal, indexers closer to chain head
568568
// and with higher success rate will be favored.
569-
let range = status.min_block.unwrap_or(0)..=(perf.latest_block + blocks_per_minute);
569+
let latest_block = status.block.max(perf.latest_block + blocks_per_minute);
570+
let range = status.min_block.unwrap_or(0)..=latest_block;
570571
let number_gte = block_requirements.number_gte.unwrap_or(0);
571572
if !range.contains(min) || !range.contains(max) || (*range.end() < number_gte) {
572573
return Err(IndexerError::Unavailable(UnavailableReason::MissingBlock));

0 commit comments

Comments
 (0)