diff --git a/stratum/db.cpp b/stratum/db.cpp index 1737ed7..1b74e21 100644 --- a/stratum/db.cpp +++ b/stratum/db.cpp @@ -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); diff --git a/stratum/stratum.cpp b/stratum/stratum.cpp index e8330f0..6758eea 100644 --- a/stratum/stratum.cpp +++ b/stratum/stratum.cpp @@ -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; @@ -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); diff --git a/stratum/stratum.h b/stratum/stratum.h index e02dbc8..e338e6b 100644 --- a/stratum/stratum.h +++ b/stratum/stratum.h @@ -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;