diff --git a/changes/2024-05-30T141430-0500.txt b/changes/2024-05-30T141430-0500.txt new file mode 100644 index 0000000000..7639f9959e --- /dev/null +++ b/changes/2024-05-30T141430-0500.txt @@ -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 diff --git a/src/Chainweb/CutDB.hs b/src/Chainweb/CutDB.hs index ca2cee9fde..50a8d21207 100644 --- a/src/Chainweb/CutDB.hs +++ b/src/Chainweb/CutDB.hs @@ -381,7 +381,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))