Skip to content

Commit

Permalink
[dag scan-api] Solve the problem that when searching for a specific b…
Browse files Browse the repository at this point in the history
…lock or daascore, the following blocks are not fully displayed
  • Loading branch information
welbon committed Jul 2, 2024
1 parent 6d86d28 commit ba505fe
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ public DIBlocksAndEdgesAndHeightGroupsVo getBlockHash(
if (block == null) {
throw new RuntimeException("Cannot find block by block hash");
}
Long endHeight = block.getHeight();
long startHeight = Math.max(block.getHeight() - heightDifference, 0L);
long blockHeight = block.getHeight();
long startHeight = Math.max(blockHeight - heightDifference, 0L);
Long endHeight = blockHeight + heightDifference;
return getBlocksAndEdgesAndHeightGroups(network, startHeight, endHeight);
}

Expand All @@ -95,8 +96,10 @@ public DIBlocksAndEdgesAndHeightGroupsVo getBlockDAAScore(
if (block == null) {
throw new RuntimeException("Cannot find block by block hash");
}
Long endHeight = block.getHeight();
long startHeight = Math.max(block.getHeight() - heightDifference, 0L);

long blockHeight = block.getHeight();
long startHeight = Math.max(blockHeight - heightDifference, 0L);
Long endHeight = blockHeight + heightDifference;
return getBlocksAndEdgesAndHeightGroups(network, startHeight, endHeight);
}

Expand Down

0 comments on commit ba505fe

Please sign in to comment.