diff options
author | mydesktop <dev.mc2@gmail.com> | 2014-05-03 12:19:43 -0400 |
---|---|---|
committer | mydesktop <dev.mc2@gmail.com> | 2014-05-03 12:19:43 -0400 |
commit | 333f975760c156727dd7408f87e937af856d8bf1 (patch) | |
tree | 1928b27eaac60f0b528f17abbc52d5ad812013d0 /src/miner | |
parent | Merge branch 'master' of github.com:monero-project/bitmonero (diff) | |
download | monero-333f975760c156727dd7408f87e937af856d8bf1.tar.xz |
initial [broken] update
Diffstat (limited to 'src/miner')
-rw-r--r-- | src/miner/simpleminer.cpp | 18 | ||||
-rw-r--r-- | src/miner/simpleminer_protocol_defs.h | 4 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/miner/simpleminer.cpp b/src/miner/simpleminer.cpp index a9f0ceab0..3af04954f 100644 --- a/src/miner/simpleminer.cpp +++ b/src/miner/simpleminer.cpp @@ -120,6 +120,7 @@ namespace mining COMMAND_RPC_LOGIN::request req = AUTO_VAL_INIT(req); req.login = m_login; req.pass = m_pass; + req.agent = "simpleminer/0.1"; COMMAND_RPC_LOGIN::response resp = AUTO_VAL_INIT(resp); if(!epee::net_utils::invoke_http_json_rpc<mining::COMMAND_RPC_LOGIN>("/", req, resp, m_http_client)) { @@ -137,7 +138,12 @@ namespace mining } pool_session_id = resp.id; //78 - if(!text_job_details_to_native_job_details(resp.job, job)) + if (resp.job.blob.empty() && resp.job.target.empty() && resp.job.job_id.empty()) + { + LOG_PRINT_L0("Job didn't change"); + continue; + } + else if(!text_job_details_to_native_job_details(resp.job, job)) { LOG_PRINT_L0("Failed to text_job_details_to_native_job_details(), disconnect and sleep...."); m_http_client.disconnect(); @@ -161,7 +167,8 @@ namespace mining COMMAND_RPC_SUBMITSHARE::response submit_response = AUTO_VAL_INIT(submit_response); submit_request.id = pool_session_id; submit_request.job_id = job.job_id; - submit_request.nonce = epee::string_tools::pod_to_hex((*((uint32_t*)&job.blob.data()[78]))); + submit_request.nonce = epee::string_tools::pod_to_hex((*((uint32_t*)&job.blob.data()[39]))); + submit_request.result = epee::string_tools::pod_to_hex(h); LOG_PRINT_L0("Share found: nonce=" << submit_request.nonce << " for job=" << job.job_id << ", submitting..."); if(!epee::net_utils::invoke_http_json_rpc<mining::COMMAND_RPC_SUBMITSHARE>("/", submit_request, submit_response, m_http_client)) { @@ -193,7 +200,12 @@ namespace mining epee::misc_utils::sleep_no_w(1000); break; } - if(!text_job_details_to_native_job_details(getjob_response, job)) + if (getjob_response.blob.empty() && getjob_response.target.empty() && getjob_response.job_id.empty()) + { + LOG_PRINT_L0("Job didn't change"); + continue; + } + else if(!text_job_details_to_native_job_details(getjob_response, job)) { LOG_PRINT_L0("Failed to text_job_details_to_native_job_details(), disconnect and sleep...."); m_http_client.disconnect(); diff --git a/src/miner/simpleminer_protocol_defs.h b/src/miner/simpleminer_protocol_defs.h index 9b70f8cbf..06b6a9053 100644 --- a/src/miner/simpleminer_protocol_defs.h +++ b/src/miner/simpleminer_protocol_defs.h @@ -36,10 +36,12 @@ namespace mining { std::string login; std::string pass; + std::string agent; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(login) KV_SERIALIZE(pass) + KV_SERIALIZE(agent) END_KV_SERIALIZE_MAP() }; @@ -82,11 +84,13 @@ namespace mining { std::string id; std::string nonce; + std::string result; std::string job_id; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(id) KV_SERIALIZE(nonce) + KV_SERIALIZE(result) KV_SERIALIZE(job_id) END_KV_SERIALIZE_MAP() }; |