Skip to content

Commit

Permalink
stratum: allow wallet filters in the .conf
Browse files Browse the repository at this point in the history
Allow to create a stratum port for only one wallet
  • Loading branch information
tpruvot committed Nov 30, 2017
1 parent 66b1504 commit 69a8f95
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
9 changes: 9 additions & 0 deletions stratum/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ void db_update_coinds(YAAMP_DB *db)
//coind->touch = true;
if(coind->newcoind)
{
// optional coin filter
bool ignore = false;
if (strlen(g_stratum_coin_include) && !strstr(g_stratum_coin_include, coind->symbol)) ignore = true;
if (strlen(g_stratum_coin_exclude) && strstr(g_stratum_coin_exclude, coind->symbol)) ignore = true;
if (ignore) {
object_delete(coind);
continue;
}

debuglog("connecting to coind %s\n", coind->symbol);

bool b = rpc_connect(&coind->rpc);
Expand Down
12 changes: 10 additions & 2 deletions stratum/stratum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ char g_sql_database[1024];
char g_sql_username[1024];
char g_sql_password[1024];

char g_stratum_algo[1024];
char g_stratum_coin_include[256];
char g_stratum_coin_exclude[256];

char g_stratum_algo[256];
double g_stratum_difficulty;

int g_stratum_max_ttf;
Expand Down Expand Up @@ -216,13 +219,18 @@ int main(int argc, char **argv)
strcpy(g_sql_username, iniparser_getstring(ini, "SQL:username", NULL));
strcpy(g_sql_password, iniparser_getstring(ini, "SQL:password", NULL));

// optional coin filters (to mine only one on a special port or a test instance)
char *coin_filter = iniparser_getstring(ini, "WALLETS:include", NULL);
strcpy(g_stratum_coin_include, coin_filter ? coin_filter : "");
coin_filter = iniparser_getstring(ini, "WALLETS:exclude", NULL);
strcpy(g_stratum_coin_exclude, coin_filter ? coin_filter : "");

strcpy(g_stratum_algo, iniparser_getstring(ini, "STRATUM:algo", NULL));
g_stratum_difficulty = iniparser_getdouble(ini, "STRATUM:difficulty", 16);
g_stratum_max_cons = iniparser_getint(ini, "STRATUM:max_cons", 5000);
g_stratum_max_ttf = iniparser_getint(ini, "STRATUM:max_ttf", 0x70000000);
g_stratum_reconnect = iniparser_getint(ini, "STRATUM:reconnect", true);
g_stratum_renting = iniparser_getint(ini, "STRATUM:renting", true);
g_stratum_segwit = iniparser_getint(ini, "STRATUM:segwit", 0);

iniparser_freedict(ini);

Expand Down
5 changes: 4 additions & 1 deletion stratum/stratum.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ extern char g_sql_database[1024];
extern char g_sql_username[1024];
extern char g_sql_password[1024];

extern char g_stratum_algo[1024];
extern char g_stratum_coin_include[256];
extern char g_stratum_coin_exclude[256];

extern char g_stratum_algo[256];
extern double g_stratum_difficulty;

extern int g_stratum_max_cons;
Expand Down

0 comments on commit 69a8f95

Please sign in to comment.