Adding share type to log output

This will display which detection mechanism caught the share.
Fixed stratum detection

Fixes #405
This commit is contained in:
Sebastian Grewe 2013-07-09 11:43:12 +02:00
parent e4f8537165
commit 7f759708c8
2 changed files with 8 additions and 3 deletions

View File

@ -68,7 +68,7 @@ if (empty($aAllBlocks)) {
$log->logDebug('No new blocks without share_id found in database');
} else {
// Loop through our unaccounted blocks
$log->logInfo("Block ID\t\tHeight\tAmount\tShare ID\tShares\tFinder");
$log->logInfo("Block ID\t\tHeight\tAmount\tShare ID\tShares\tFinder\tType");
foreach ($aAllBlocks as $iIndex => $aBlock) {
if (empty($aBlock['share_id'])) {
// Fetch this blocks upstream ID
@ -105,7 +105,8 @@ if (empty($aAllBlocks)) {
. $aBlock['amount'] . "\t"
. $iCurrentUpstreamId . "\t\t"
. $iRoundShares . "\t"
. "[$iAccountId] " . $user->getUserName($iAccountId)
. "[$iAccountId] " . $user->getUserName($iAccountId) . "\t"
. $share->share_type
);
// Notify users

View File

@ -193,8 +193,9 @@ class Share {
$ppheader = sprintf('%08d', $aBlock['version']) . word_reverse($aBlock['previousblockhash']) . word_reverse($aBlock['merkleroot']) . dechex($aBlock['time']) . $aBlock['bits'] . dechex($aBlock['nonce']);
$stmt = $this->mysqli->prepare("SELECT SUBSTRING_INDEX( `username` , '.', 1 ) AS account, id FROM $this->table WHERE solution = ? LIMIT 1");
if ($this->checkStmt($stmt) && $stmt->bind_param('s', $scrypt_hash) && $stmt->execute() && $result = $stmt->get_result()->num_rows > 0) {
if ($this->checkStmt($stmt) && $stmt->bind_param('s', $scrypt_hash) && $stmt->execute() && $result = $stmt->get_result()) {
$this->oUpstream = $result->fetch_object();
$this->share_type = 'startum_solution';
if (!empty($this->oUpstream->account) && is_int($this->oUpstream->id))
return true;
}
@ -203,6 +204,7 @@ class Share {
$stmt = $this->mysqli->prepare("SELECT SUBSTRING_INDEX( `username` , '.', 1 ) AS account, id FROM $this->table WHERE solution LIKE CONCAT(?, '%') LIMIT 1");
if ($this->checkStmt($stmt) && $stmt->bind_param('s', $ppheader) && $stmt->execute() && $result = $stmt->get_result()) {
$this->oUpstream = $result->fetch_object();
$this->share_type = 'pp_solution';
if (!empty($this->oUpstream->account) && is_int($this->oUpstream->id))
return true;
}
@ -219,6 +221,7 @@ class Share {
ORDER BY id ASC LIMIT 1");
if ($this->checkStmt($stmt) && $stmt->bind_param('iii', $last, $aBlock['time'], $Block['time']) && $stmt->execute() && $result = $stmt->get_result()) {
$this->oUpstream = $result->fetch_object();
$this->share_type = 'upstream_share';
if (!empty($this->oUpstream->account) && is_int($this->oUpstream->id))
return true;
}
@ -234,6 +237,7 @@ class Share {
ORDER BY id ASC LIMIT 1");
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $last, $aBlock['time']) && $stmt->execute() && $result = $stmt->get_result()) {
$this->oUpstream = $result->fetch_object();
$this->share_type = 'any_share';
if (!empty($this->oUpstream->account) && is_int($this->oUpstream->id))
return true;
}