VarDiff maxDelta support
@@ -85,6 +85,22 @@ namespace MiningCore.VarDiff
// Possible New Diff
var newDiff = difficulty * options.TargetTime / avg;
+
+ // Max delta
+ if (options.MaxDelta.HasValue && options.MaxDelta > 0)
+ {
+ var delta = Math.Abs(newDiff - difficulty);
+
+ if (delta > options.MaxDelta)
+ {
+ if (newDiff > difficulty)
+ newDiff -= delta - options.MaxDelta.Value;
+ else if (newDiff < difficulty)
+ newDiff += delta - options.MaxDelta.Value;
+ }
+ }
+
+ // Clamp to valid range
if (newDiff < minDiff)
newDiff = minDiff;
if (newDiff > maxDiff)
