Skip to content

Commit

Permalink
Include last computation when using range with step.
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Sep 26, 2023
1 parent 872d50d commit ce9fc4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/server/routes/indexer/computer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,8 @@ export const computer: Router.Middleware = async (ctx) => {
} else if (blockStep) {
for (
let blockHeight = blocks[0].height;
blockHeight <= blocks[1].height;
// Make sure to include the last computation.
blockHeight <= blocks[1].height + blockStep - 1n;
blockHeight += blockStep
) {
// Sorted ascending by block, so find first computation with block
Expand All @@ -570,7 +571,8 @@ export const computer: Router.Middleware = async (ctx) => {
} else if (times && timeStep) {
for (
let blockTime = blocks[0].timeUnixMs;
blockTime <= blocks[1].timeUnixMs;
// Make sure to include the last computation.
blockTime <= blocks[1].timeUnixMs + timeStep - 1n;
blockTime += timeStep
) {
// Sorted ascending by block, so find first computation with block
Expand Down

0 comments on commit ce9fc4d

Please sign in to comment.