12 Jul, 2018

Yiimp max difficulty patch

Go to yiimp/stratum/stratum.cpp

Change
char g_stratum_algo[256];
double g_stratum_difficulty;

To
char g_stratum_algo[256];
double g_stratum_difficulty;
double g_stratum_max_difficulty;

Change
g_stratum_difficulty = iniparser_getdouble(ini, "STRATUM:difficulty", 16);
g_stratum_max_cons = iniparser_getint(ini, "STRATUM:max_cons", 5000);

To
g_stratum_difficulty = iniparser_getdouble(ini, "STRATUM:difficulty", 16);
g_stratum_max_difficulty = iniparser_getdouble(ini, "STRATUM:max_difficulty", 0);
g_stratum_max_cons = iniparser_getint(ini, "STRATUM:max_cons", 5000);

Go to yiimp/stratum/stratum.h

Change
extern char g_stratum_algo[256];
extern double g_stratum_difficulty;

To
extern char g_stratum_algo[256];
extern double g_stratum_difficulty;
extern double g_stratum_max_difficulty;

Go to
yiimp/stratum/client_difficulty.cpp

Change
double client_normalize_difficulty(double difficulty)
{
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;

return difficulty;
}

To
double client_normalize_difficulty(double difficulty)
{
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(g_stratum_max_difficulty > 0 && difficulty > g_stratum_max_difficulty)
{
printf("Difficulty too high, reverting\n");
difficulty = g_stratum_max_difficulty;
}
else if(difficulty > 1)
{
difficulty = floor(difficulty/2)*2;
}

printf("Difficulty is %lf\n",difficulty);

return difficulty;
}

Then go to where you have c++ (.cpp) files /home/pool/yiimp/stratum

make clean
make

Then copy the stratum executable to where you nave it installed, usually is in /var/stratum/

root@crypto4:/var/stratum# ls -al
total 78796
drwxrwxr-x 3 www-data www-data 4096 Jul 12 16:47 .
drwxr-xr-x 14 root root 4096 Jul 2 21:19 ..
-rwxrwxr-x 1 www-data www-data 15936 Jul 2 21:19 blocknotify
-rw-r--r-- 1 root root 61077536 Jul 12 15:42 client.log
drwxrwxr-x 2 www-data www-data 4096 Jul 12 15:51 config
-rw-r--r-- 1 root root 99 Jul 10 00:14 enter_screens.sh
-rw-r--r-- 1 root root 42 Jul 4 20:57 help.log
-rw-r--r-- 1 root root 28344 Jul 10 18:30 reject.log
-rw-r--r-- 1 root root 155 Jul 10 15:40 restart.sh
-rwxrwxr-x 1 www-data www-data 53 Jul 2 21:19 run.sh
-rwxr-xr-x 1 root root 3418152 Jul 12 16:47 stratum <----- YOU MUST CHANGE THIS -rw-r--r-- 1 root root 16097912 Jul 12 17:56 stratum.log root@crypto4:/var/stratum#

Now edit /var/stratum/config/scrypt.conf or /var/stratum/config/coin.conf to be like this :

...
[STRATUM]
algo = scrypt
difficulty = 256
max_difficulty = 1024
max_ttf = 40000
...

Hope it helps.

About : adminux

Leave a Reply

Your email address will not be published. Required fields are marked *