Skip to content

Commit b2e4672

Browse files
committed
Further optimization
1 parent 5736872 commit b2e4672

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Libplanet.RocksDBStore/RocksDBStore.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1836,9 +1836,13 @@ private IEnumerable<BlockHash> IterateIndexesPruned(
18361836
}
18371837

18381838
long count = 0;
1839+
long limitUpperBound = CountIndex(chainId) - offset;
1840+
long actualLimit = limit is { } l
1841+
? Math.Min(l, limitUpperBound)
1842+
: limitUpperBound;
18391843
foreach (BlockHash hash in IterateIndexesInnerPruned(chainId, offset))
18401844
{
1841-
if (count >= limit)
1845+
if (count >= actualLimit)
18421846
{
18431847
yield break;
18441848
}

0 commit comments

Comments
 (0)