Skip to content

Commit b30b827

Browse files
committed
cleanup
1 parent a4d86f7 commit b30b827

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

database/tbcd/level/level.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,10 @@ func (l *ldb) KeystonesByHeight(ctx context.Context, height uint32, depth int) (
20202020
return nil, errors.New("depth must not be 0")
20212021
}
20222022
start := int64(height)
2023-
end := start + d + 1
2023+
end := start + d
2024+
if depth > 0 {
2025+
end += 1
2026+
}
20242027
if end > math.MaxUint32 {
20252028
return nil, errors.New("the overflow that matters")
20262029
}
@@ -2050,7 +2053,7 @@ func (l *ldb) KeystonesByHeight(ctx context.Context, height uint32, depth int) (
20502053
if len(kssList) == 0 {
20512054
return nil, database.NotFoundError(fmt.Sprintf("no first occurrence "+
20522055
"keystones range: %v < %v",
2053-
min(start, end), max(start, end)))
2056+
min(start+1, end), max(start, end)-1))
20542057
}
20552058

20562059
return kssList, nil

0 commit comments

Comments
 (0)