1
0
mirror of https://github.com/GOSTSec/poolserver synced 2025-01-14 08:47:53 +00:00

Fix bug with winning share difficulty

This commit is contained in:
Intel 2014-05-14 12:19:55 -04:00
parent b29cf2f08b
commit 456fd37476

View File

@ -243,9 +243,12 @@ namespace Stratum
if (target <= job.blockTarget) {
sLog.Info(LOG_STRATUM, "We have found a block candidate!");
// copy job diff because job will be deleted after submiting share by block template update
uint64 jobDiff = job.diff;
if (_server->SubmitBlock(block)) {
std::string query("INSERT INTO `shares` (`rem_host`, `username`, `our_result`, `upstream_result`, `reason`, `solution`, `time`, `difficulty`) VALUES ");
query += Util::FS("(INET_NTOA(%u), '%s', 1, 1, '', '%s', FROM_UNIXTIME(%u), %u)", _ip, username.c_str(), Util::BinToASCII(Util::Reverse(hash)).c_str(), Util::Date(), job.diff);
query += Util::FS("(INET_NTOA(%u), '%s', 1, 1, '', '%s', FROM_UNIXTIME(%u), %u)", _ip, username.c_str(), Util::BinToASCII(Util::Reverse(hash)).c_str(), Util::Date(), jobDiff);
sDatabase.ExecuteAsync(query.c_str());
JSON response;