mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
stratum: min diff and anti-flood adjustments
This commit is contained in:
parent
c49c8b30f2
commit
343ec492c8
1 changed files with 6 additions and 4 deletions
|
@ -3,7 +3,9 @@
|
|||
|
||||
double client_normalize_difficulty(double difficulty)
|
||||
{
|
||||
if(difficulty <= 0.001) difficulty = 0.001;
|
||||
double min_stratum_diff = g_stratum_difficulty * 0.5;
|
||||
if(difficulty < min_stratum_diff)
|
||||
difficulty = min_stratum_diff;
|
||||
else if(difficulty < 1) difficulty = floor(difficulty*1000/2)/1000*2;
|
||||
else if(difficulty > 1) difficulty = floor(difficulty/2)*2;
|
||||
|
||||
|
@ -48,13 +50,12 @@ void client_change_difficulty(YAAMP_CLIENT *client, double difficulty)
|
|||
|
||||
void client_adjust_difficulty(YAAMP_CLIENT *client)
|
||||
{
|
||||
if(client->difficulty_remote)
|
||||
{
|
||||
if(client->difficulty_remote) {
|
||||
client_change_difficulty(client, client->difficulty_remote);
|
||||
return;
|
||||
}
|
||||
|
||||
if(client->shares_per_minute > 600)
|
||||
if(client->shares_per_minute > 100)
|
||||
client_change_difficulty(client, client->difficulty_actual*4);
|
||||
|
||||
else if(client->difficulty_fixed)
|
||||
|
@ -79,6 +80,7 @@ int client_send_difficulty(YAAMP_CLIENT *client, double difficulty)
|
|||
client_call(client, "mining.set_difficulty", "[%.0f]", difficulty);
|
||||
else
|
||||
client_call(client, "mining.set_difficulty", "[%.3f]", difficulty);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void client_initialize_difficulty(YAAMP_CLIENT *client)
|
||||
|
|
Loading…
Add table
Reference in a new issue