add retarget-time option
- allow setting a retarget time different to block time - tidy config printing (just reordering) - fix webui nethash formatting
This commit is contained in:
parent
6f65aae241
commit
c7984e0e5f
|
@ -1,16 +1,19 @@
|
||||||
pool-port = 4242
|
pool-port = 4242
|
||||||
|
webui-port = 4243
|
||||||
rpc-host = 127.0.0.1
|
rpc-host = 127.0.0.1
|
||||||
rpc-port = 28081
|
rpc-port = 28081
|
||||||
rpc-timeout = 15
|
|
||||||
wallet-rpc-host = 127.0.0.1
|
wallet-rpc-host = 127.0.0.1
|
||||||
wallet-rpc-port = 28084
|
wallet-rpc-port = 28084
|
||||||
|
rpc-timeout = 15
|
||||||
pool-wallet = 9y4V6rSRbXDhmoNQpCrDBQXFM25rqFBZYBq8RepazSLSBwsj5kRtuM9iCSuz3vs9KbfZhrQj1BKRxVCpyqii7pca3vJaNFs
|
pool-wallet = 9y4V6rSRbXDhmoNQpCrDBQXFM25rqFBZYBq8RepazSLSBwsj5kRtuM9iCSuz3vs9KbfZhrQj1BKRxVCpyqii7pca3vJaNFs
|
||||||
pool-start-diff = 1000
|
pool-start-diff = 1000
|
||||||
share-mul = 2.0
|
|
||||||
pool-fee = 0.01
|
pool-fee = 0.01
|
||||||
payment-threshold = 0.33
|
payment-threshold = 0.33
|
||||||
|
share-mul = 2.0
|
||||||
|
retarget-time = 120
|
||||||
log-level = 5
|
log-level = 5
|
||||||
webui-port = 4243
|
log-file =
|
||||||
|
block-notified = 0
|
||||||
disable-self-select = 0
|
disable-self-select = 0
|
||||||
data-dir = ./data
|
data-dir = ./data
|
||||||
pid-file =
|
pid-file =
|
||||||
|
|
96
src/pool.c
96
src/pool.c
|
@ -132,6 +132,7 @@ typedef struct config_t
|
||||||
char pool_wallet[ADDRESS_MAX];
|
char pool_wallet[ADDRESS_MAX];
|
||||||
uint64_t pool_start_diff;
|
uint64_t pool_start_diff;
|
||||||
double share_mul;
|
double share_mul;
|
||||||
|
uint32_t retarget_time;
|
||||||
double pool_fee;
|
double pool_fee;
|
||||||
double payment_threshold;
|
double payment_threshold;
|
||||||
uint32_t pool_port;
|
uint32_t pool_port;
|
||||||
|
@ -834,7 +835,7 @@ retarget(client_t *client, job_t *job)
|
||||||
if (job->block_template)
|
if (job->block_template)
|
||||||
bd = job->block_template->difficulty;
|
bd = job->block_template->difficulty;
|
||||||
double duration = difftime(time(NULL), client->connected_since);
|
double duration = difftime(time(NULL), client->connected_since);
|
||||||
uint8_t retarget_time = client->is_xnp ? 5 : 120;
|
uint8_t retarget_time = client->is_xnp ? 5 : config.retarget_time;
|
||||||
uint64_t target = fmin(fmax((double)client->hashes /
|
uint64_t target = fmin(fmax((double)client->hashes /
|
||||||
duration * retarget_time, config.pool_start_diff), bd);
|
duration * retarget_time, config.pool_start_diff), bd);
|
||||||
job->target = target;
|
job->target = target;
|
||||||
|
@ -2627,11 +2628,13 @@ read_config(const char *config_file)
|
||||||
config.rpc_timeout = 15;
|
config.rpc_timeout = 15;
|
||||||
config.pool_start_diff = 100;
|
config.pool_start_diff = 100;
|
||||||
config.share_mul = 2.0;
|
config.share_mul = 2.0;
|
||||||
|
config.retarget_time = 120;
|
||||||
config.pool_fee = 0.01;
|
config.pool_fee = 0.01;
|
||||||
config.payment_threshold = 0.33;
|
config.payment_threshold = 0.33;
|
||||||
config.pool_port = 4242;
|
config.pool_port = 4242;
|
||||||
config.log_level = 5;
|
config.log_level = 5;
|
||||||
config.webui_port = 4243;
|
config.webui_port = 4243;
|
||||||
|
config.block_notified = false;
|
||||||
config.disable_self_select = false;
|
config.disable_self_select = false;
|
||||||
strncpy(config.data_dir, "./data", 7);
|
strncpy(config.data_dir, "./data", 7);
|
||||||
|
|
||||||
|
@ -2681,7 +2684,15 @@ read_config(const char *config_file)
|
||||||
if (!val)
|
if (!val)
|
||||||
continue;
|
continue;
|
||||||
val[strcspn(val, "\r\n")] = 0;
|
val[strcspn(val, "\r\n")] = 0;
|
||||||
if (strcmp(key, "rpc-host") == 0)
|
if (strcmp(key, "pool-port") == 0)
|
||||||
|
{
|
||||||
|
config.pool_port = atoi(val);
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "webui-port") == 0)
|
||||||
|
{
|
||||||
|
config.webui_port = atoi(val);
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "rpc-host") == 0)
|
||||||
{
|
{
|
||||||
strncpy(config.rpc_host, val, sizeof(config.rpc_host));
|
strncpy(config.rpc_host, val, sizeof(config.rpc_host));
|
||||||
}
|
}
|
||||||
|
@ -2689,10 +2700,6 @@ read_config(const char *config_file)
|
||||||
{
|
{
|
||||||
config.rpc_port = atoi(val);
|
config.rpc_port = atoi(val);
|
||||||
}
|
}
|
||||||
else if (strcmp(key, "rpc-timeout") == 0)
|
|
||||||
{
|
|
||||||
config.rpc_timeout = atoi(val);
|
|
||||||
}
|
|
||||||
else if (strcmp(key, "wallet-rpc-host") == 0)
|
else if (strcmp(key, "wallet-rpc-host") == 0)
|
||||||
{
|
{
|
||||||
strncpy(config.wallet_rpc_host, val, sizeof(config.rpc_host));
|
strncpy(config.wallet_rpc_host, val, sizeof(config.rpc_host));
|
||||||
|
@ -2701,6 +2708,10 @@ read_config(const char *config_file)
|
||||||
{
|
{
|
||||||
config.wallet_rpc_port = atoi(val);
|
config.wallet_rpc_port = atoi(val);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(key, "rpc-timeout") == 0)
|
||||||
|
{
|
||||||
|
config.rpc_timeout = atoi(val);
|
||||||
|
}
|
||||||
else if (strcmp(key, "pool-wallet") == 0)
|
else if (strcmp(key, "pool-wallet") == 0)
|
||||||
{
|
{
|
||||||
strncpy(config.pool_wallet, val, sizeof(config.pool_wallet));
|
strncpy(config.pool_wallet, val, sizeof(config.pool_wallet));
|
||||||
|
@ -2709,10 +2720,6 @@ read_config(const char *config_file)
|
||||||
{
|
{
|
||||||
config.pool_start_diff = strtoumax(val, NULL, 10);
|
config.pool_start_diff = strtoumax(val, NULL, 10);
|
||||||
}
|
}
|
||||||
else if (strcmp(key, "share-mul") == 0)
|
|
||||||
{
|
|
||||||
config.share_mul = atof(val);
|
|
||||||
}
|
|
||||||
else if (strcmp(key, "pool-fee") == 0)
|
else if (strcmp(key, "pool-fee") == 0)
|
||||||
{
|
{
|
||||||
config.pool_fee = atof(val);
|
config.pool_fee = atof(val);
|
||||||
|
@ -2721,18 +2728,18 @@ read_config(const char *config_file)
|
||||||
{
|
{
|
||||||
config.payment_threshold = atof(val);
|
config.payment_threshold = atof(val);
|
||||||
}
|
}
|
||||||
else if (strcmp(key, "pool-port") == 0)
|
else if (strcmp(key, "share-mul") == 0)
|
||||||
{
|
{
|
||||||
config.pool_port = atoi(val);
|
config.share_mul = atof(val);
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "retarget-time") == 0)
|
||||||
|
{
|
||||||
|
config.retarget_time = atoi(val);
|
||||||
}
|
}
|
||||||
else if (strcmp(key, "log-level") == 0)
|
else if (strcmp(key, "log-level") == 0)
|
||||||
{
|
{
|
||||||
config.log_level = atoi(val);
|
config.log_level = atoi(val);
|
||||||
}
|
}
|
||||||
else if (strcmp(key, "webui-port") == 0)
|
|
||||||
{
|
|
||||||
config.webui_port = atoi(val);
|
|
||||||
}
|
|
||||||
else if (strcmp(key, "log-file") == 0)
|
else if (strcmp(key, "log-file") == 0)
|
||||||
{
|
{
|
||||||
strncpy(config.log_file, val, sizeof(config.log_file));
|
strncpy(config.log_file, val, sizeof(config.log_file));
|
||||||
|
@ -2775,22 +2782,47 @@ read_config(const char *config_file)
|
||||||
}
|
}
|
||||||
static void print_config()
|
static void print_config()
|
||||||
{
|
{
|
||||||
log_info("\nCONFIG:\n rpc_host = %s\n rpc_port = %u\n "
|
log_info("\nCONFIG:\n"
|
||||||
"rpc_timeout = %u\n pool_wallet = %s\n "
|
" pool-port = %u\n"
|
||||||
"pool_start_diff = %"PRIu64"\n share_mul = %.2f\n "
|
" webui-port=%u\n"
|
||||||
"pool_fee = %.3f\n payment_threshold = %.2f\n "
|
" rpc-host = %s\n"
|
||||||
"wallet_rpc_host = %s\n wallet_rpc_port = %u\n pool_port = %u\n "
|
" rpc-port = %u\n"
|
||||||
"log_level = %u\n webui_port=%u\n "
|
" wallet-rpc-host = %s\n"
|
||||||
"log-file = %s\n block-notified = %u\n "
|
" wallet-rpc-port = %u\n"
|
||||||
"disable-self-select = %u\n "
|
" rpc-timeout = %u\n"
|
||||||
"data-dir = %s\n pid-file = %s\n forked = %u\n",
|
" pool-wallet = %s\n"
|
||||||
config.rpc_host, config.rpc_port, config.rpc_timeout,
|
" pool-start-diff = %"PRIu64"\n"
|
||||||
config.pool_wallet, config.pool_start_diff, config.share_mul,
|
" pool-fee = %.3f\n"
|
||||||
config.pool_fee, config.payment_threshold,
|
" payment-threshold = %.2f\n"
|
||||||
config.wallet_rpc_host, config.wallet_rpc_port, config.pool_port,
|
" share-mul = %.2f\n"
|
||||||
config.log_level, config.webui_port,
|
" retarget-time = %u\n"
|
||||||
config.log_file, config.block_notified, config.disable_self_select,
|
" log-level = %u\n"
|
||||||
config.data_dir, config.pid_file, config.forked);
|
" log-file = %s\n"
|
||||||
|
" block-notified = %u\n"
|
||||||
|
" disable-self-select = %u\n"
|
||||||
|
" data-dir = %s\n"
|
||||||
|
" pid-file = %s\n"
|
||||||
|
" forked = %u\n",
|
||||||
|
config.pool_port,
|
||||||
|
config.webui_port,
|
||||||
|
config.rpc_host,
|
||||||
|
config.rpc_port,
|
||||||
|
config.wallet_rpc_host,
|
||||||
|
config.wallet_rpc_port,
|
||||||
|
config.rpc_timeout,
|
||||||
|
config.pool_wallet,
|
||||||
|
config.pool_start_diff,
|
||||||
|
config.pool_fee,
|
||||||
|
config.payment_threshold,
|
||||||
|
config.share_mul,
|
||||||
|
config.retarget_time,
|
||||||
|
config.log_level,
|
||||||
|
config.log_file,
|
||||||
|
config.block_notified,
|
||||||
|
config.disable_self_select,
|
||||||
|
config.data_dir,
|
||||||
|
config.pid_file,
|
||||||
|
config.forked);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -90,10 +90,10 @@
|
||||||
return parseInt(hr) + " H/s";
|
return parseInt(hr) + " H/s";
|
||||||
else if (hr < 1000000)
|
else if (hr < 1000000)
|
||||||
return parseFloat(hr/1000).toFixed(2) + " KH/s";
|
return parseFloat(hr/1000).toFixed(2) + " KH/s";
|
||||||
else if (hr < 1000000000000)
|
else if (hr < 1000000000)
|
||||||
return parseFloat(hr/1000000).toFixed(2) + " MH/s";
|
return parseFloat(hr/1000000).toFixed(2) + " MH/s";
|
||||||
else
|
else
|
||||||
return parseFloat(hr/1000000000000).toFixed(2) + " GH/s";
|
return parseFloat(hr/1000000000).toFixed(2) + " GH/s";
|
||||||
}
|
}
|
||||||
|
|
||||||
var f = document.querySelector("form");
|
var f = document.querySelector("form");
|
||||||
|
|
Loading…
Reference in New Issue