stratum: pre-check bad usernames before db add

This commit is contained in:
Tanguy Pruvot 2018-05-01 15:34:01 +02:00
parent 1bfec2be32
commit 138b0079bb

View file

@ -229,6 +229,11 @@ bool client_authorize(YAAMP_CLIENT *client, json_value *json_params)
}
}
if (!is_base58(client->username)) {
clientlog(client, "bad mining address %s", client->username);
return false;
}
bool reset = client_initialize_multialgo(client);
if(reset) return false;
@ -256,12 +261,8 @@ bool client_authorize(YAAMP_CLIENT *client, json_value *json_params)
CommonUnlock(&g_db_mutex);
}
bool is_bad_address = !is_base58(client->username);
// when auto exchange is disabled, only authorize good wallet address...
if (!g_autoexchange && !client_validate_user_address(client))
is_bad_address = true;
if (is_bad_address) {
if (!g_autoexchange && !client_validate_user_address(client)) {
clientlog(client, "bad mining address %s", client->username);
client_send_result(client, "false");