Moving shares per block into findblock cron
To better support more payout systems I have moved the share calculation for a block into the findblock cron. This way these statistics are always available and not depending on the actual payout method.
This commit is contained in:
parent
68ec939302
commit
596b0eac93
@ -66,11 +66,15 @@ if (empty($aTransactions['transactions'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verbose("\n\n");
|
||||||
// Now with our blocks added we can scan for their upstream shares
|
// Now with our blocks added we can scan for their upstream shares
|
||||||
$aAllBlocks = $block->getAllUnaccounted('ASC');
|
$aAllBlocks = $block->getAllUnaccounted('ASC');
|
||||||
|
if (empty($aAllBlocks)) {
|
||||||
|
verbose("No new unaccounted blocks found\n");
|
||||||
|
}
|
||||||
|
|
||||||
// Loop through our unaccounted blocks
|
// Loop through our unaccounted blocks
|
||||||
verbose("Block ID\tBlock Height\tShare ID\tFinder\t\t\tStatus\n");
|
verbose("Block ID\tBlock Height\tShare ID\tShares\tFinder\t\t\tStatus\n");
|
||||||
foreach ($aAllBlocks as $iIndex => $aBlock) {
|
foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||||
if (empty($aBlock['share_id'])) {
|
if (empty($aBlock['share_id'])) {
|
||||||
// Fetch this blocks upstream ID
|
// Fetch this blocks upstream ID
|
||||||
@ -82,16 +86,24 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
verbose($share->getError() . "\n");
|
verbose($share->getError() . "\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Fetch share information
|
||||||
|
$iPreviousShareId = @$aAllBlocks[$iIndex - 1]['share_id'] ? $aAllBlocks[$iIndex - 1]['share_id'] : 0;
|
||||||
|
$iRoundShares = $share->getRoundShares($iPreviousShareId, $iCurrentUpstreamId);
|
||||||
|
|
||||||
// Store new information
|
// Store new information
|
||||||
$strStatus = "OK";
|
$strStatus = "OK";
|
||||||
if (!$block->setShareId($aBlock['id'], $iCurrentUpstreamId))
|
if (!$block->setShareId($aBlock['id'], $iCurrentUpstreamId))
|
||||||
$strStatus = "Share ID Failed";
|
$strStatus = "Share ID Failed";
|
||||||
if (!$block->setFinder($aBlock['id'], $iAccountId))
|
if (!$block->setFinder($aBlock['id'], $iAccountId))
|
||||||
$strStatus = "Finder Failed";
|
$strStatus = "Finder Failed";
|
||||||
|
if (!$block->setShares($aBlock['id'], $iRoundShares))
|
||||||
|
$strStatus = "Shares Failed";
|
||||||
|
|
||||||
verbose(
|
verbose(
|
||||||
$aBlock['id'] . "\t\t"
|
$aBlock['id'] . "\t\t"
|
||||||
. $aBlock['height'] . "\t\t"
|
. $aBlock['height'] . "\t\t"
|
||||||
. $iCurrentUpstreamId . "\t\t"
|
. $iCurrentUpstreamId . "\t\t"
|
||||||
|
. $iRoundShares . "\t"
|
||||||
. "[$iAccountId] " . $user->getUserName($iAccountId) . "\t\t"
|
. "[$iAccountId] " . $user->getUserName($iAccountId) . "\t\t"
|
||||||
. $strStatus
|
. $strStatus
|
||||||
. "\n"
|
. "\n"
|
||||||
|
|||||||
@ -37,20 +37,11 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
$aAccountShares = $share->getSharesForAccounts($iPreviousShareId, $aBlock['share_id']);
|
$aAccountShares = $share->getSharesForAccounts($iPreviousShareId, $aBlock['share_id']);
|
||||||
$iRoundShares = $share->getRoundShares($iPreviousShareId, $aBlock['share_id']);
|
$iRoundShares = $share->getRoundShares($iPreviousShareId, $aBlock['share_id']);
|
||||||
|
|
||||||
// Table header for block details
|
|
||||||
verbose("ID\tHeight\tTime\t\tShares\tFinder\t\tShare ID\tPrev Share\t\tStatus\n");
|
|
||||||
verbose($aBlock['id'] . "\t" . $aBlock['height'] . "\t" . $aBlock['time'] . "\t" . $iRoundShares . "\t" . $user->getUserName($aBlock['account_id']) . "\t" . $iCurrentUpstreamId . "\t\t" . $iPreviousShareId);
|
|
||||||
|
|
||||||
if (empty($aAccountShares)) {
|
if (empty($aAccountShares)) {
|
||||||
verbose("\nNo shares found for this block\n\n");
|
verbose("\nNo shares found for this block\n\n");
|
||||||
sleep(2);
|
sleep(2);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$strStatus = "OK";
|
|
||||||
// Store share information for this block
|
|
||||||
if (!$block->setShares($aBlock['id'], $iRoundShares))
|
|
||||||
$strStatus = "Shares Failed";
|
|
||||||
verbose("\t\t$strStatus\n\n");
|
|
||||||
|
|
||||||
// Table header for account shares
|
// Table header for account shares
|
||||||
verbose("ID\tUsername\tValid\tInvalid\tPercentage\tPayout\t\tDonation\tFee\t\tStatus\n");
|
verbose("ID\tUsername\tValid\tInvalid\tPercentage\tPayout\t\tDonation\tFee\t\tStatus\n");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user