mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-03-26 17:51:45 +01:00
change stratum_api TAG to match filename
This commit is contained in:
parent
a7bae3ce71
commit
65f906eb3d
@ -8,13 +8,15 @@
|
||||
|
||||
|
||||
#define BUFFER_SIZE 1024
|
||||
static const char *TAG = "stratum client";
|
||||
static const char *TAG = "stratum_api";
|
||||
|
||||
static char *json_rpc_buffer = NULL;
|
||||
static size_t json_rpc_buffer_size = 0;
|
||||
|
||||
static int send_uid = 1;
|
||||
|
||||
static void debug_stratum_tx(const char *);
|
||||
|
||||
void initialize_stratum_buffer()
|
||||
{
|
||||
json_rpc_buffer = malloc(BUFFER_SIZE);
|
||||
@ -254,7 +256,7 @@ int subscribe_to_stratum(int socket, char ** extranonce, int * extranonce2_len)
|
||||
// Subscribe
|
||||
char subscribe_msg[BUFFER_SIZE];
|
||||
sprintf(subscribe_msg, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": [\"bitaxe v2.2\"]}\n", send_uid++);
|
||||
ESP_LOGI(TAG, "-> %s", subscribe_msg);
|
||||
debug_stratum_tx(subscribe_msg);
|
||||
write(socket, subscribe_msg, strlen(subscribe_msg));
|
||||
char * line;
|
||||
line = receive_jsonrpc_line(socket);
|
||||
@ -272,7 +274,7 @@ int suggest_difficulty(int socket, uint32_t difficulty)
|
||||
{
|
||||
char difficulty_msg[BUFFER_SIZE];
|
||||
sprintf(difficulty_msg, "{\"id\": %d, \"method\": \"mining.suggest_difficulty\", \"params\": [%d]}\n", send_uid++, difficulty);
|
||||
ESP_LOGI(TAG, "-> %s", difficulty_msg);
|
||||
debug_stratum_tx(difficulty_msg);
|
||||
write(socket, difficulty_msg, strlen(difficulty_msg));
|
||||
|
||||
/* TODO: fix race condition with first mining.notify message
|
||||
@ -292,7 +294,7 @@ int auth_to_stratum(int socket, const char * username)
|
||||
char authorize_msg[BUFFER_SIZE];
|
||||
sprintf(authorize_msg, "{\"id\": %d, \"method\": \"mining.authorize\", \"params\": [\"%s\", \"x\"]}\n",
|
||||
send_uid++, username);
|
||||
ESP_LOGI(TAG, "-> %s", authorize_msg);
|
||||
debug_stratum_tx(authorize_msg);
|
||||
|
||||
write(socket, authorize_msg, strlen(authorize_msg));
|
||||
|
||||
@ -305,7 +307,7 @@ void submit_share(int socket, const char * username, const char * jobid,
|
||||
char submit_msg[BUFFER_SIZE];
|
||||
sprintf(submit_msg, "{\"id\": %d, \"method\": \"mining.submit\", \"params\": [\"%s\", \"%s\", \"%s\", \"%08x\", \"%08x\"]}\n",
|
||||
send_uid++, username, jobid, extranonce_2, ntime, nonce);
|
||||
ESP_LOGI(TAG, "-> %s", submit_msg);
|
||||
debug_stratum_tx(submit_msg);
|
||||
write(socket, submit_msg, strlen(submit_msg));
|
||||
|
||||
}
|
||||
@ -324,8 +326,12 @@ void configure_version_rolling(int socket)
|
||||
// Configure
|
||||
char configure_msg[BUFFER_SIZE * 2];
|
||||
sprintf(configure_msg, "{\"id\": %d, \"method\": \"mining.configure\", \"params\": [[\"version-rolling\"], {\"version-rolling.mask\": \"ffffffff\"}]}\n", send_uid++);
|
||||
ESP_LOGI(TAG, "-> %s", configure_msg);
|
||||
ESP_LOGI(TAG, "tx: %s", configure_msg);
|
||||
write(socket, configure_msg, strlen(configure_msg));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void debug_stratum_tx(const char * msg) {
|
||||
ESP_LOGI(TAG, "tx: %s", msg);
|
||||
}
|
@ -37,7 +37,7 @@ void stratum_task(void * pvParameters)
|
||||
|
||||
//get ip address from hostname
|
||||
IP_ADDR4(&ip_Addr, 0, 0, 0, 0);
|
||||
printf("Get IP for URL: %s\n", STRATUM_URL);
|
||||
ESP_LOGI(TAG, "Get IP for URL: %s\n", STRATUM_URL);
|
||||
dns_gethostbyname(STRATUM_URL, &ip_Addr, dns_found_cb, NULL);
|
||||
while (!bDNSFound);
|
||||
|
||||
@ -47,7 +47,7 @@ void stratum_task(void * pvParameters)
|
||||
ip4_addr2(&ip_Addr.u_addr.ip4),
|
||||
ip4_addr3(&ip_Addr.u_addr.ip4),
|
||||
ip4_addr4(&ip_Addr.u_addr.ip4));
|
||||
printf("Connecting to: stratum+tcp://%s:%d (%s)\n", STRATUM_URL, PORT, host_ip);
|
||||
ESP_LOGI(TAG, "Connecting to: stratum+tcp://%s:%d (%s)\n", STRATUM_URL, PORT, host_ip);
|
||||
|
||||
while (1) {
|
||||
struct sockaddr_in dest_addr;
|
||||
@ -88,7 +88,7 @@ void stratum_task(void * pvParameters)
|
||||
while (1)
|
||||
{
|
||||
char * line = receive_jsonrpc_line( GLOBAL_STATE->sock);
|
||||
ESP_LOGI(TAG, "stratum rx: %s", line); //debug incoming stratum messages
|
||||
ESP_LOGI(TAG, "rx: %s", line); //debug incoming stratum messages
|
||||
|
||||
stratum_method method = parse_stratum_method(line);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user