From 240d74fe5c9c443b699c7110006039c6fe6d567c Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 25 May 2023 18:03:29 +1000 Subject: [PATCH] Special casing testnet turns out to be unnecessary since the diff is still relative to an absolute reference value. --- ckpool.conf | 2 -- src/ckpool.c | 2 -- src/ckpool.h | 5 ----- src/generator.c | 2 -- src/stratifier.c | 4 ++-- 5 files changed, 2 insertions(+), 13 deletions(-) diff --git a/ckpool.conf b/ckpool.conf index e90794f5..d6c9cd8e 100644 --- a/ckpool.conf +++ b/ckpool.conf @@ -4,14 +4,12 @@ "url" : "localhost:8332", "auth" : "user", "pass" : "pass", - "testnet" : false, "notify" : true }, { "url" : "backup:8332", "auth" : "user", "pass" : "pass", - "testnet" : false, "notify" : false } ], diff --git a/src/ckpool.c b/src/ckpool.c index 913351b5..808dd453 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -1251,14 +1251,12 @@ static void parse_btcds(ckpool_t *ckp, const json_t *arr_val, const int arr_size ckp->btcdauth = ckzalloc(sizeof(char *) * arr_size); ckp->btcdpass = ckzalloc(sizeof(char *) * arr_size); ckp->btcdnotify = ckzalloc(sizeof(bool *) * arr_size); - ckp->btcdtestnet = ckzalloc(sizeof(bool *) * arr_size); for (i = 0; i < arr_size; i++) { val = json_array_get(arr_val, i); json_get_string(&ckp->btcdurl[i], val, "url"); json_get_string(&ckp->btcdauth[i], val, "auth"); json_get_string(&ckp->btcdpass[i], val, "pass"); json_get_bool(&ckp->btcdnotify[i], val, "notify"); - json_get_bool(&ckp->btcdtestnet[i], val, "testnet"); } } diff --git a/src/ckpool.h b/src/ckpool.h index 61faad3f..8ff02cec 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -120,7 +120,6 @@ struct server_instance { char *auth; char *pass; bool notify; - bool testnet; bool alive; connsock_t cs; }; @@ -217,9 +216,6 @@ struct ckpool_instance { /* Should we disable the throbber */ bool quiet; - /* Are we mining on testnet */ - bool testnet; - /* Have we given warnings about the inability to raise buf sizes */ bool wmem_warn; bool rmem_warn; @@ -230,7 +226,6 @@ struct ckpool_instance { char **btcdauth; char **btcdpass; bool *btcdnotify; - bool *btcdtestnet; int blockpoll; // How frequently in ms to poll bitcoind for block updates int nonce1length; // Extranonce1 length int nonce2length; // Extranonce2 length diff --git a/src/generator.c b/src/generator.c index a88c35b9..9fafa5b1 100644 --- a/src/generator.c +++ b/src/generator.c @@ -299,7 +299,6 @@ retry: goto retry; living: gdata->current_si = alive; - ckp->testnet = alive->testnet; cs = &alive->cs; LOGINFO("Connected to live server %s:%s", cs->url, cs->port); send_proc(ckp->connector, alive ? "accept" : "reject"); @@ -3296,7 +3295,6 @@ static void setup_servers(ckpool_t *ckp) si->auth = ckp->btcdauth[i]; si->pass = ckp->btcdpass[i]; si->notify = ckp->btcdnotify[i]; - si->testnet = ckp->btcdtestnet[i]; si->id = i; cs = &si->cs; cs->ckp = ckp; diff --git a/src/stratifier.c b/src/stratifier.c index 4a23ca4e..f384689b 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1036,7 +1036,7 @@ static void add_base(ckpool_t *ckp, sdata_t *sdata, workbase_t *wb, bool *new_bl wb->network_diff = 1; stats->network_diff = wb->network_diff; if (stats->network_diff != old_diff) - LOGWARNING("Network diff set to %.1f%s", stats->network_diff, ckp->testnet ? " in testnet mode!": ""); + LOGWARNING("Network diff set to %.1f", stats->network_diff); len = strlen(ckp->logdir) + 8 + 1 + 16 + 1; wb->logdir = ckzalloc(len); @@ -5724,7 +5724,7 @@ test_blocksolve(const stratum_instance_t *client, const workbase_t *wb, const uc bool ret; /* Submit anything over 99.9% of the diff in case of rounding errors */ - network_diff = ckp->testnet ? sdata->current_workbase->network_diff * 0.499 : sdata->current_workbase->network_diff * 0.999; + network_diff = sdata->current_workbase->network_diff * 0.999; if (likely(diff < network_diff)) return;