Skip to content

Commit

Permalink
cpu: Fail gracefully if unsupported mining algo gets into scanhash
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Nov 7, 2014
1 parent afa1df6 commit 318cc05
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion driver-cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ static int64_t cpu_scanhash(struct thr_info *thr, struct work *work, int64_t max

/* scan nonces for a proof-of-work hash */
{
sha256_func func;
sha256_func func = NULL;
switch (work_mining_algorithm(work)->algo)
{
#ifdef USE_SCRYPT
Expand All @@ -832,6 +832,8 @@ static int64_t cpu_scanhash(struct thr_info *thr, struct work *work, int64_t max
func = sha256_funcs[opt_algo];
break;
}
if (unlikely(!func))
applogr(0, LOG_ERR, "%"PRIpreprv": Unknown mining algorithm", thr->cgpu->proc_repr);
rc = (*func)(
thr,
work->midstate,
Expand Down

0 comments on commit 318cc05

Please sign in to comment.