Browse Source

Sanity check for absurd target setting and divide by zero.

nfactor-troky
Con Kolivas 11 years ago
parent
commit
876a83024d
  1. 2
      cgminer.c

2
cgminer.c

@ -3114,6 +3114,8 @@ static void calc_diff(struct work *work, double known)
if (opt_scrypt) if (opt_scrypt)
d64 *= (double)65536; d64 *= (double)65536;
dcut64 = le256todouble(work->target); dcut64 = le256todouble(work->target);
if (unlikely(!dcut64))
dcut64 = 1;
work->work_difficulty = d64 / dcut64; work->work_difficulty = d64 / dcut64;
} }
difficulty = work->work_difficulty; difficulty = work->work_difficulty;

Loading…
Cancel
Save