Skip to content

Commit

Permalink
fix get_entries edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
aditsachde committed Jul 20, 2024
1 parent 9cfc205 commit a722bc3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/ctmonitor/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ func (f Fetch) get_entries(ctx context.Context, reqBody io.ReadCloser, query url

dataTiles := make([]tileWithBytes, 0)

sthFinalTile := tlog.TileForIndex(sunlight.TileHeight, tlog.StoredHashIndex(0, int64(sth.TreeSize)-1))
// Special case the final tile to ensure we always fetch a tile that exists
if lastTile.N == sthFinalTile.N {
lastTile.W = sthFinalTile.W
}

// In this case, the last tile is the same as the first tile so we only need to fetch one tile
if firstTile.N == lastTile.N {
data, err := f.getTile(ctx, lastTile)
Expand Down

0 comments on commit a722bc3

Please sign in to comment.