Skip to content

Commit

Permalink
Build a mining_algorithms list
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Nov 5, 2014
1 parent 7f48e9f commit 3185251
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions miner.c
Expand Up @@ -370,6 +370,7 @@ static char datestamp[40];
static char best_share[ALLOC_H2B_SHORTV] = "0";
double best_diff = 0;

struct mining_algorithm *mining_algorithms;
struct mining_goal_info *mining_goals;
int active_goals = 1;

Expand Down Expand Up @@ -1027,6 +1028,16 @@ const char *set_malgo_scrypt()

#endif

static
__attribute__((constructor))
void init_mining_goals(struct mining_goal_info * const goal, const struct mining_algorithm * const malgo)
{
LL_APPEND(mining_algorithms, (&malgo_sha256d));
#ifdef USE_SCRYPT
LL_APPEND(mining_algorithms, (&malgo_scrypt));
#endif
}

static
int mining_goals_name_cmp(const struct mining_goal_info * const a, const struct mining_goal_info * const b)
{
Expand Down
2 changes: 2 additions & 0 deletions miner.h
Expand Up @@ -1131,6 +1131,8 @@ struct mining_algorithm {
float reasonable_low_nonce_diff;

void (*hash_data_f)(void *digest, const void *data);

struct mining_algorithm *next;
};

struct mining_goal_info {
Expand Down

0 comments on commit 3185251

Please sign in to comment.