mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 09:27:25 +00:00
stratum: add diff_min and diff_max optional conf fields
This commit is contained in:
parent
07277d9096
commit
38a114b8dd
3 changed files with 10 additions and 4 deletions
|
@ -3,12 +3,10 @@
|
|||
|
||||
double client_normalize_difficulty(double difficulty)
|
||||
{
|
||||
double min_stratum_diff = g_stratum_difficulty * 0.5;
|
||||
if(difficulty < min_stratum_diff)
|
||||
difficulty = min_stratum_diff;
|
||||
if(difficulty < g_stratum_min_diff) difficulty = g_stratum_min_diff;
|
||||
else if(difficulty < 1) difficulty = floor(difficulty*1000/2)/1000*2;
|
||||
else if(difficulty > 1) difficulty = floor(difficulty/2)*2;
|
||||
|
||||
if(difficulty > g_stratum_max_diff) difficulty = g_stratum_max_diff;
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ char g_stratum_coin_exclude[256];
|
|||
|
||||
char g_stratum_algo[256];
|
||||
double g_stratum_difficulty;
|
||||
double g_stratum_min_diff;
|
||||
double g_stratum_max_diff;
|
||||
|
||||
int g_stratum_max_ttf;
|
||||
int g_stratum_max_cons = 5000;
|
||||
|
@ -260,6 +262,9 @@ int main(int argc, char **argv)
|
|||
|
||||
strcpy(g_stratum_algo, iniparser_getstring(ini, "STRATUM:algo", NULL));
|
||||
g_stratum_difficulty = iniparser_getdouble(ini, "STRATUM:difficulty", 16);
|
||||
g_stratum_min_diff = iniparser_getdouble(ini, "STRATUM:diff_min", g_stratum_difficulty/2);
|
||||
g_stratum_max_diff = iniparser_getdouble(ini, "STRATUM:diff_max", g_stratum_difficulty*8192);
|
||||
|
||||
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);
|
||||
|
@ -297,6 +302,7 @@ int main(int argc, char **argv)
|
|||
g_allow_rolltime = strcmp(g_stratum_algo,"x11evo");
|
||||
g_allow_rolltime = g_allow_rolltime && strcmp(g_stratum_algo,"timetravel");
|
||||
g_allow_rolltime = g_allow_rolltime && strcmp(g_stratum_algo,"bitcore");
|
||||
g_allow_rolltime = g_allow_rolltime && strcmp(g_stratum_algo,"exosis");
|
||||
if (!g_allow_rolltime)
|
||||
stratumlog("note: time roll disallowed for %s algo\n", g_current_algo->name);
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ extern char g_stratum_coin_exclude[256];
|
|||
|
||||
extern char g_stratum_algo[256];
|
||||
extern double g_stratum_difficulty;
|
||||
extern double g_stratum_min_diff;
|
||||
extern double g_stratum_max_diff;
|
||||
|
||||
extern int g_stratum_max_cons;
|
||||
extern int g_stratum_max_ttf;
|
||||
|
|
Loading…
Add table
Reference in a new issue