Skip to content

Commit

Permalink
Further optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
greymistcube committed Nov 29, 2024
1 parent 5736872 commit b2e4672
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Libplanet.RocksDBStore/RocksDBStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1836,9 +1836,13 @@ private IEnumerable<BlockHash> IterateIndexesPruned(
}

long count = 0;
long limitUpperBound = CountIndex(chainId) - offset;
long actualLimit = limit is { } l
? Math.Min(l, limitUpperBound)
: limitUpperBound;
foreach (BlockHash hash in IterateIndexesInnerPruned(chainId, offset))
{
if (count >= limit)
if (count >= actualLimit)
{
yield break;
}
Expand Down

0 comments on commit b2e4672

Please sign in to comment.