From 72d2f63315d1650acbc0ae157996d263ada1bec5 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Sun, 6 Aug 2023 22:58:54 -0400 Subject: [PATCH] nearestPowerOfTwo --- src/models/StratumV1ClientStatistics.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/models/StratumV1ClientStatistics.ts b/src/models/StratumV1ClientStatistics.ts index 538f224..c2b7aa1 100644 --- a/src/models/StratumV1ClientStatistics.ts +++ b/src/models/StratumV1ClientStatistics.ts @@ -88,6 +88,9 @@ export class StratumV1ClientStatistics { x = x | (x >> 16); x = x | (x >> 32); const res = x - (x >> 1); + if (res == 0 && val * 100 < MIN_DIFF) { + return MIN_DIFF; + } if (res == 0) { return this.nearestPowerOfTwo(val * 100) / 100; }