diff --git a/components/stratum/include/stratum_api.h b/components/stratum/include/stratum_api.h
index 944a922d8..b1b68d5dd 100644
--- a/components/stratum/include/stratum_api.h
+++ b/components/stratum/include/stratum_api.h
@@ -63,7 +63,7 @@ void STRATUM_V1_parse(StratumApiV1Message *message, const char *stratum_json);
void STRATUM_V1_free_mining_notify(mining_notify *params);
-int STRATUM_V1_authenticate(int socket, const char *username);
+int STRATUM_V1_authenticate(int socket, const char *username, const char *pass);
void STRATUM_V1_configure_version_rolling(int socket, uint32_t * version_mask);
diff --git a/components/stratum/stratum_api.c b/components/stratum/stratum_api.c
index fbccc0891..22cd4b21d 100644
--- a/components/stratum/stratum_api.c
+++ b/components/stratum/stratum_api.c
@@ -304,11 +304,11 @@ int STRATUM_V1_suggest_difficulty(int socket, uint32_t difficulty)
return 1;
}
-int STRATUM_V1_authenticate(int socket, const char *username)
+int STRATUM_V1_authenticate(int socket, const char *username, const char *pass)
{
char authorize_msg[BUFFER_SIZE];
- sprintf(authorize_msg, "{\"id\": %d, \"method\": \"mining.authorize\", \"params\": [\"%s\", \"x\"]}\n",
- send_uid++, username);
+ sprintf(authorize_msg, "{\"id\": %d, \"method\": \"mining.authorize\", \"params\": [\"%s\", \"%s\"]}\n",
+ send_uid++, username, pass);
debug_stratum_tx(authorize_msg);
write(socket, authorize_msg, strlen(authorize_msg));
@@ -344,11 +344,17 @@ void STRATUM_V1_configure_version_rolling(int socket, uint32_t * version_mask)
line = STRATUM_V1_receive_jsonrpc_line(socket);
ESP_LOGI(TAG, "Received result %s", line);
- StratumApiV1Message stratum_api_v1_message;
- STRATUM_V1_parse(&stratum_api_v1_message, line);
- if (stratum_api_v1_message.method == MINING_SET_VERSION_MASK || stratum_api_v1_message.method == STRATUM_RESULT_VERSION_MASK) {
- *version_mask = stratum_api_v1_message.version_mask;
- ESP_LOGI(TAG, "Set version mask: %08lx", *version_mask);
+
+ cJSON * result = cJSON_GetObjectItem(line, "result");
+ if (result != NULL)
+ {
+ cJSON * version_rolling_enabled = cJSON_GetObjectItem(result, "version-rolling");
+ if (cJSON_IsBool(version_rolling_enabled) && cJSON_IsTrue(version_rolling_enabled)){
+ cJSON * mask = cJSON_GetObjectItem(result, "version-rolling.mask");
+ uint32_t version_mask = strtoul(mask->valuestring, NULL, 16);
+ ESP_LOGI(TAG, "Set version mask: %08lx", version_mask);
+ }
+
}
free(line);
diff --git a/main/http_server/axe-os/src/app/components/edit/edit.component.html b/main/http_server/axe-os/src/app/components/edit/edit.component.html
index 8ffbc26b8..84138689b 100644
--- a/main/http_server/axe-os/src/app/components/edit/edit.component.html
+++ b/main/http_server/axe-os/src/app/components/edit/edit.component.html
@@ -28,6 +28,10 @@
+
+
+
+
diff --git a/main/http_server/axe-os/src/app/components/edit/edit.component.ts b/main/http_server/axe-os/src/app/components/edit/edit.component.ts
index 1da53380a..cec14f684 100644
--- a/main/http_server/axe-os/src/app/components/edit/edit.component.ts
+++ b/main/http_server/axe-os/src/app/components/edit/edit.component.ts
@@ -58,6 +58,7 @@ export class EditComponent implements OnInit {
Validators.max(65353)
]],
stratumUser: [info.stratumUser, [Validators.required]],
+ stratumPassword: ['password', [Validators.required]],
ssid: [info.ssid, [Validators.required]],
wifiPass: ['password'],
coreVoltage: [info.coreVoltage, [Validators.required]],
@@ -107,6 +108,9 @@ export class EditComponent implements OnInit {
if (form.wifiPass === 'password') {
delete form.wifiPass;
}
+ if (form.stratumPassword === 'password') {
+ delete form.stratumPassword;
+ }
this.systemService.updateSystem(this.uri, form)
.pipe(this.loadingService.lockUIUntilComplete())
diff --git a/main/http_server/axe-os/src/app/components/settings/settings.component.ts b/main/http_server/axe-os/src/app/components/settings/settings.component.ts
index 74e8baeb8..1d4493a6c 100644
--- a/main/http_server/axe-os/src/app/components/settings/settings.component.ts
+++ b/main/http_server/axe-os/src/app/components/settings/settings.component.ts
@@ -64,6 +64,7 @@ export class SettingsComponent {
Validators.max(65353)
]],
stratumUser: [info.stratumUser, [Validators.required]],
+ stratumPassword: ['password', [Validators.required]],
ssid: [info.ssid, [Validators.required]],
wifiPass: ['password'],
coreVoltage: [info.coreVoltage, [Validators.required]],
@@ -112,6 +113,9 @@ export class SettingsComponent {
if (form.wifiPass === 'password') {
delete form.wifiPass;
}
+ if (form.stratumPassword === 'password') {
+ delete form.stratumPassword;
+ }
this.systemService.updateSystem(undefined, form)
.pipe(this.loadingService.lockUIUntilComplete())
diff --git a/main/http_server/http_server.c b/main/http_server/http_server.c
index 2bd5824da..c01e1d852 100644
--- a/main/http_server/http_server.c
+++ b/main/http_server/http_server.c
@@ -264,6 +264,9 @@ static esp_err_t PATCH_update_settings(httpd_req_t * req)
if ((item = cJSON_GetObjectItem(root, "stratumUser")) != NULL) {
nvs_config_set_string(NVS_CONFIG_STRATUM_USER, item->valuestring);
}
+ if ((item = cJSON_GetObjectItem(root, "stratumPassword")) != NULL) {
+ nvs_config_set_string(NVS_CONFIG_STRATUM_PASS, item->valuestring);
+ }
if ((item = cJSON_GetObjectItem(root, "stratumPort")) != NULL) {
nvs_config_set_u16(NVS_CONFIG_STRATUM_PORT, item->valueint);
}
diff --git a/main/tasks/stratum_task.c b/main/tasks/stratum_task.c
index f93b116aa..c460ed044 100644
--- a/main/tasks/stratum_task.c
+++ b/main/tasks/stratum_task.c
@@ -110,7 +110,9 @@ void stratum_task(void * pvParameters)
STRATUM_V1_suggest_difficulty(GLOBAL_STATE->sock, STRATUM_DIFFICULTY);
char * username = nvs_config_get_string(NVS_CONFIG_STRATUM_USER, STRATUM_USER);
- STRATUM_V1_authenticate(GLOBAL_STATE->sock, username);
+ char * password = nvs_config_get_string(NVS_CONFIG_STRATUM_PASS, STRATUM_PW);
+ STRATUM_V1_authenticate(GLOBAL_STATE->sock, username, password);
+ free(password);
free(username);
ESP_LOGI(TAG, "Extranonce: %s", GLOBAL_STATE->extranonce_str);