Add "X-Mining-Extensions: midstate" to HTTP headers
Drop support for the the deprecated "midstate" and "hash1" fields.
This commit is contained in:
parent
d26b0d8b81
commit
9ce0db5100
2 changed files with 6 additions and 18 deletions
14
cpu-miner.c
14
cpu-miner.c
|
@ -207,8 +207,6 @@ static struct option options[] = {
|
||||||
|
|
||||||
struct work {
|
struct work {
|
||||||
unsigned char data[128];
|
unsigned char data[128];
|
||||||
unsigned char hash1[64];
|
|
||||||
unsigned char midstate[32];
|
|
||||||
unsigned char target[32];
|
unsigned char target[32];
|
||||||
|
|
||||||
unsigned char hash[32];
|
unsigned char hash[32];
|
||||||
|
@ -242,22 +240,10 @@ static bool jobj_binary(const json_t *obj, const char *key,
|
||||||
|
|
||||||
static bool work_decode(const json_t *val, struct work *work)
|
static bool work_decode(const json_t *val, struct work *work)
|
||||||
{
|
{
|
||||||
if (unlikely(!jobj_binary(val, "midstate",
|
|
||||||
work->midstate, sizeof(work->midstate)))) {
|
|
||||||
applog(LOG_ERR, "JSON inval midstate");
|
|
||||||
goto err_out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unlikely(!jobj_binary(val, "data", work->data, sizeof(work->data)))) {
|
if (unlikely(!jobj_binary(val, "data", work->data, sizeof(work->data)))) {
|
||||||
applog(LOG_ERR, "JSON inval data");
|
applog(LOG_ERR, "JSON inval data");
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(!jobj_binary(val, "hash1", work->hash1, sizeof(work->hash1)))) {
|
|
||||||
applog(LOG_ERR, "JSON inval hash1");
|
|
||||||
goto err_out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unlikely(!jobj_binary(val, "target", work->target, sizeof(work->target)))) {
|
if (unlikely(!jobj_binary(val, "target", work->target, sizeof(work->target)))) {
|
||||||
applog(LOG_ERR, "JSON inval target");
|
applog(LOG_ERR, "JSON inval target");
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
10
util.c
10
util.c
|
@ -213,7 +213,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
|
||||||
struct upload_buffer upload_data;
|
struct upload_buffer upload_data;
|
||||||
json_error_t err = { };
|
json_error_t err = { };
|
||||||
struct curl_slist *headers = NULL;
|
struct curl_slist *headers = NULL;
|
||||||
char len_hdr[64], user_agent_hdr[128];
|
char len_hdr[64];
|
||||||
char curl_err_str[CURL_ERROR_SIZE];
|
char curl_err_str[CURL_ERROR_SIZE];
|
||||||
long timeout = opt_timeout;
|
long timeout = opt_timeout;
|
||||||
struct header_info hi = { };
|
struct header_info hi = { };
|
||||||
|
@ -255,12 +255,14 @@ json_t *json_rpc_call(CURL *curl, const char *url,
|
||||||
upload_data.len = strlen(rpc_req);
|
upload_data.len = strlen(rpc_req);
|
||||||
sprintf(len_hdr, "Content-Length: %lu",
|
sprintf(len_hdr, "Content-Length: %lu",
|
||||||
(unsigned long) upload_data.len);
|
(unsigned long) upload_data.len);
|
||||||
sprintf(user_agent_hdr, "User-Agent: %s", PACKAGE_STRING);
|
|
||||||
|
|
||||||
headers = curl_slist_append(headers,
|
headers = curl_slist_append(headers,
|
||||||
"Content-type: application/json");
|
"Content-Type: application/json");
|
||||||
headers = curl_slist_append(headers, len_hdr);
|
headers = curl_slist_append(headers, len_hdr);
|
||||||
headers = curl_slist_append(headers, user_agent_hdr);
|
headers = curl_slist_append(headers, "User-Agent: " PACKAGE_STRING);
|
||||||
|
headers = curl_slist_append(headers,
|
||||||
|
"X-Mining-Extensions: midstate");
|
||||||
|
headers = curl_slist_append(headers, "Accept:"); /* disable Accept hdr*/
|
||||||
headers = curl_slist_append(headers, "Expect:"); /* disable Expect hdr*/
|
headers = curl_slist_append(headers, "Expect:"); /* disable Expect hdr*/
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||||
|
|
Loading…
Reference in a new issue