Skip to content

Commit

Permalink
correct cut pruning math: max -> min
Browse files Browse the repository at this point in the history
Change-Id: Idc27197e527dbc88089acddc812c0d3812c6eaf9
  • Loading branch information
chessai authored and edmundnoble committed Jun 14, 2024
1 parent 9fb14da commit 17622c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changes/2024-05-30T141430-0500.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixes cut pruning logic; during a previous change, there was a math error that caused no cuts to
ever be pruned from RocksDB
2 changes: 1 addition & 1 deletion src/Chainweb/CutDB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ pruneCuts
pruneCuts logfun v conf curAvgBlockHeight cutHashesStore = do
let avgBlockHeightPruningDepth = _cutDbParamsAvgBlockHeightPruningDepth conf
let pruneCutHeight =
avgCutHeightAt v (curAvgBlockHeight - max curAvgBlockHeight avgBlockHeightPruningDepth)
avgCutHeightAt v (curAvgBlockHeight - min curAvgBlockHeight avgBlockHeightPruningDepth)
logfun @T.Text Info $ "pruning CutDB before cut height " <> T.pack (show pruneCutHeight)
deleteRangeRocksDb (unCasify cutHashesStore)
(Nothing, Just (pruneCutHeight, 0, maxBound :: CutId))
Expand Down

0 comments on commit 17622c6

Please sign in to comment.