From ee04e437be7fba07ce20dc356645bc1412287a21 Mon Sep 17 00:00:00 2001 From: johnny9 <985648+johnny9@users.noreply.github.com> Date: Sat, 27 May 2023 09:48:08 -0400 Subject: [PATCH] stratum: don't try to check mining.suggest_difficulty result Current implementation has a race condition with the first mining.notify message and can cause the miner to take a long time to start if it misses that message. --- components/stratum/stratum_api.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/stratum/stratum_api.c b/components/stratum/stratum_api.c index 6dfebc88..ec0da6c6 100644 --- a/components/stratum/stratum_api.c +++ b/components/stratum/stratum_api.c @@ -230,12 +230,15 @@ int suggest_difficulty(int socket, uint32_t difficulty) sprintf(difficulty_msg, "{\"id\": %d, \"method\": \"mining.suggest_difficulty\", \"params\": [%d]}\n", send_uid++, difficulty); ESP_LOGI(TAG, "-> %s", difficulty_msg); write(socket, difficulty_msg, strlen(difficulty_msg)); + + /* TODO: fix race condition with first mining.notify message char * line; line = receive_jsonrpc_line(socket); ESP_LOGI(TAG, "Received result %s", line); free(line); + */ return 1; }