From 138b0079bb2c78930aad106ce691d3a733dca6f3 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 1 May 2018 15:34:01 +0200 Subject: [PATCH] stratum: pre-check bad usernames before db add --- stratum/client.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/stratum/client.cpp b/stratum/client.cpp index 60a0d9b..6f0c9d5 100644 --- a/stratum/client.cpp +++ b/stratum/client.cpp @@ -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");