From c4506c7e47333624a3f475d0f7019ff5e34632ab Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 26 Sep 2014 11:20:49 +1000 Subject: [PATCH] Round away from zero when choosing optimal diff --- src/stratifier.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stratifier.c b/src/stratifier.c index 63d4cb07..a454581c 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1735,7 +1735,9 @@ static void add_submit(ckpool_t *ckp, stratum_instance_t *client, int diff, bool if (drr > 0.15 && drr < 0.4) return; - optimal = round(dsps * 3.33); + /* Round away from zero to avoid bouncing around diffs at the lower + * end of the scale. */ + optimal = lround(dsps * 3.33); /* Clamp to mindiff ~ network_diff */ if (optimal < ckp->mindiff) optimal = ckp->mindiff;