mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-11-17 00:07:47 +00:00
StartumServer: moved warnings to log level 4
This commit is contained in:
parent
14bb308794
commit
0be078cb09
1 changed files with 22 additions and 22 deletions
|
@ -183,7 +183,7 @@ bool StratumServer::on_submit(StratumClient* client, uint32_t id, const char* jo
|
||||||
for (size_t i = 0; job_id_str[i]; ++i) {
|
for (size_t i = 0; job_id_str[i]; ++i) {
|
||||||
uint32_t d;
|
uint32_t d;
|
||||||
if (!from_hex(job_id_str[i], d)) {
|
if (!from_hex(job_id_str[i], d)) {
|
||||||
LOGWARN(1, "client: invalid params ('job_id' is not a hex integer)");
|
LOGWARN(4, "client: invalid params ('job_id' is not a hex integer)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
job_id = (job_id << 4) + d;
|
job_id = (job_id << 4) + d;
|
||||||
|
@ -194,7 +194,7 @@ bool StratumServer::on_submit(StratumClient* client, uint32_t id, const char* jo
|
||||||
for (int i = static_cast<int>(sizeof(uint32_t)) - 1; i >= 0; --i) {
|
for (int i = static_cast<int>(sizeof(uint32_t)) - 1; i >= 0; --i) {
|
||||||
uint32_t d[2];
|
uint32_t d[2];
|
||||||
if (!from_hex(nonce_str[i * 2], d[0]) || !from_hex(nonce_str[i * 2 + 1], d[1])) {
|
if (!from_hex(nonce_str[i * 2], d[0]) || !from_hex(nonce_str[i * 2 + 1], d[1])) {
|
||||||
LOGWARN(1, "Client: invalid params ('nonce' is not a hex integer)");
|
LOGWARN(4, "Client: invalid params ('nonce' is not a hex integer)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
nonce = (nonce << 8) | (d[0] << 4) | d[1];
|
nonce = (nonce << 8) | (d[0] << 4) | d[1];
|
||||||
|
@ -251,7 +251,7 @@ bool StratumServer::on_submit(StratumClient* client, uint32_t id, const char* jo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGWARN(1, "client: got a share with invalid job id");
|
LOGWARN(4, "client: got a share with invalid job id");
|
||||||
|
|
||||||
const bool result = send(client,
|
const bool result = send(client,
|
||||||
[id](void* buf)
|
[id](void* buf)
|
||||||
|
@ -380,7 +380,7 @@ void StratumServer::on_share_found(uv_work_t* req)
|
||||||
|
|
||||||
const uint32_t blob_size = block.get_hashing_blob(share->m_templateId, share->m_extraNonce, blob, height, difficulty, sidechain_difficulty, seed_hash, nonce_offset);
|
const uint32_t blob_size = block.get_hashing_blob(share->m_templateId, share->m_extraNonce, blob, height, difficulty, sidechain_difficulty, seed_hash, nonce_offset);
|
||||||
if (!blob_size) {
|
if (!blob_size) {
|
||||||
LOGWARN(1, "client: got a stale share");
|
LOGWARN(4, "client: got a stale share");
|
||||||
share->m_result = SubmittedShare::Result::STALE;
|
share->m_result = SubmittedShare::Result::STALE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -392,7 +392,7 @@ void StratumServer::on_share_found(uv_work_t* req)
|
||||||
|
|
||||||
hash pow_hash;
|
hash pow_hash;
|
||||||
if (!pool->calculate_hash(blob, blob_size, seed_hash, pow_hash)) {
|
if (!pool->calculate_hash(blob, blob_size, seed_hash, pow_hash)) {
|
||||||
LOGWARN(1, "client: couldn't check share PoW");
|
LOGWARN(4, "client: couldn't check share PoW");
|
||||||
share->m_result = SubmittedShare::Result::COULDNT_CHECK_POW;
|
share->m_result = SubmittedShare::Result::COULDNT_CHECK_POW;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ void StratumServer::on_share_found(uv_work_t* req)
|
||||||
share->m_result = SubmittedShare::Result::OK;
|
share->m_result = SubmittedShare::Result::OK;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOGWARN(1, "got a low diff share from " << static_cast<char*>(client->m_addrString));
|
LOGWARN(4, "got a low diff share from " << static_cast<char*>(client->m_addrString));
|
||||||
share->m_result = SubmittedShare::Result::LOW_DIFF;
|
share->m_result = SubmittedShare::Result::LOW_DIFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,34 +529,34 @@ bool StratumServer::StratumClient::process_request(char* data, uint32_t /*size*/
|
||||||
{
|
{
|
||||||
rapidjson::Document doc;
|
rapidjson::Document doc;
|
||||||
if (doc.ParseInsitu(data).HasParseError()) {
|
if (doc.ParseInsitu(data).HasParseError()) {
|
||||||
LOGWARN(1, "client: invalid JSON request ('id' field not found)");
|
LOGWARN(4, "client: invalid JSON request (parse error)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!doc.IsObject()) {
|
if (!doc.IsObject()) {
|
||||||
LOGWARN(1, "client: invalid JSON request (not an object)");
|
LOGWARN(4, "client: invalid JSON request (not an object)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!doc.HasMember("id")) {
|
if (!doc.HasMember("id")) {
|
||||||
LOGWARN(1, "client: invalid JSON request ('id' field not found)");
|
LOGWARN(4, "client: invalid JSON request ('id' field not found)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& id = doc["id"];
|
auto& id = doc["id"];
|
||||||
if (!id.IsUint()) {
|
if (!id.IsUint()) {
|
||||||
LOGWARN(1, "client: invalid JSON request ('id' field is not an integer)");
|
LOGWARN(4, "client: invalid JSON request ('id' field is not an integer)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!doc.HasMember("method")) {
|
if (!doc.HasMember("method")) {
|
||||||
LOGWARN(1, "client: invalid JSON request ('method' field not found)");
|
LOGWARN(4, "client: invalid JSON request ('method' field not found)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& method = doc["method"];
|
auto& method = doc["method"];
|
||||||
if (!method.IsString()) {
|
if (!method.IsString()) {
|
||||||
LOGWARN(1, "client: invalid JSON request ('method' field is not a string)");
|
LOGWARN(4, "client: invalid JSON request ('method' field is not a string)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ bool StratumServer::StratumClient::process_request(char* data, uint32_t /*size*/
|
||||||
return process_submit(doc, id.GetUint());
|
return process_submit(doc, id.GetUint());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOGWARN(1, "client: invalid JSON request (unknown method)");
|
LOGWARN(4, "client: invalid JSON request (unknown method)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,51 +585,51 @@ bool StratumServer::StratumClient::process_login(rapidjson::Document& /*doc*/, u
|
||||||
bool StratumServer::StratumClient::process_submit(rapidjson::Document& doc, uint32_t id)
|
bool StratumServer::StratumClient::process_submit(rapidjson::Document& doc, uint32_t id)
|
||||||
{
|
{
|
||||||
if (!doc.HasMember("params")) {
|
if (!doc.HasMember("params")) {
|
||||||
LOGWARN(1, "client: invalid JSON request ('params' field not found)");
|
LOGWARN(4, "client: invalid JSON request ('params' field not found)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& params = doc["params"];
|
auto& params = doc["params"];
|
||||||
if (!params.IsObject()) {
|
if (!params.IsObject()) {
|
||||||
LOGWARN(1, "client: invalid JSON request ('params' field is not an object)");
|
LOGWARN(4, "client: invalid JSON request ('params' field is not an object)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params.HasMember("id")) {
|
if (!params.HasMember("id")) {
|
||||||
LOGWARN(1, "client: invalid params ('id' field not found)");
|
LOGWARN(4, "client: invalid params ('id' field not found)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& rpcId = params["id"];
|
auto& rpcId = params["id"];
|
||||||
if (!rpcId.IsString()) {
|
if (!rpcId.IsString()) {
|
||||||
LOGWARN(1, "client: invalid params ('id' field is not a string)");
|
LOGWARN(4, "client: invalid params ('id' field is not a string)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params.HasMember("job_id")) {
|
if (!params.HasMember("job_id")) {
|
||||||
LOGWARN(1, "client: invalid params ('job_id' field not found)");
|
LOGWARN(4, "client: invalid params ('job_id' field not found)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& job_id = params["job_id"];
|
auto& job_id = params["job_id"];
|
||||||
if (!job_id.IsString()) {
|
if (!job_id.IsString()) {
|
||||||
LOGWARN(1, "client: invalid params ('job_id' field is not a string)");
|
LOGWARN(4, "client: invalid params ('job_id' field is not a string)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params.HasMember("nonce")) {
|
if (!params.HasMember("nonce")) {
|
||||||
LOGWARN(1, "client: invalid params ('nonce' field not found)");
|
LOGWARN(4, "client: invalid params ('nonce' field not found)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& nonce = params["nonce"];
|
auto& nonce = params["nonce"];
|
||||||
if (!nonce.IsString()) {
|
if (!nonce.IsString()) {
|
||||||
LOGWARN(1, "client: invalid params ('nonce' field is not a string)");
|
LOGWARN(4, "client: invalid params ('nonce' field is not a string)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonce.GetStringLength() != sizeof(uint32_t) * 2) {
|
if (nonce.GetStringLength() != sizeof(uint32_t) * 2) {
|
||||||
LOGWARN(1, "client: invalid params ('nonce' field has invalid length)");
|
LOGWARN(4, "client: invalid params ('nonce' field has invalid length)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue