[FIX] Skip payouts until block has a share_id

This commit is contained in:
Sebastian Grewe 2013-11-11 12:51:06 +01:00
parent 9ccc3403f8
commit d155804a06
3 changed files with 15 additions and 0 deletions

View File

@ -40,6 +40,12 @@ if (empty($aAllBlocks)) {
$count = 0;
foreach ($aAllBlocks as $iIndex => $aBlock) {
// If we have unaccounted blocks without share_ids, they might not have been inserted yet
if (!$aBlock['share_id']) {
$log->logError('E0062: Block has no share_id, not running payouts');
$monitoring->endCronjob($cron_name, 'E0062', 0, true);
}
// We support some dynamic share targets but fall back to our fixed value
// Re-calculate after each run due to re-targets in this loop
if ($config['pplns']['shares']['type'] == 'blockavg' && $block->getBlockCount() > 0) {
@ -50,6 +56,7 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
$pplns_target = $config['pplns']['shares']['default'];
}
// Fetch our last paid block information
if ($iLastBlockId = $setting->getValue('last_accounted_block_id')) {
$aLastAccountedBlock = $block->getBlockById($iLastBlockId);
} else {

View File

@ -42,6 +42,13 @@ $count = 0;
// Table header for account shares
$log->logInfo("ID\tUsername\tValid\tInvalid\tPercentage\tPayout\t\tDonation\tFee");
foreach ($aAllBlocks as $iIndex => $aBlock) {
// If we have unaccounted blocks without share_ids, they might not have been inserted yet
if (!$aBlock['share_id']) {
$log->logError('E0062: Block has no share_id, not running payouts');
$monitoring->endCronjob($cron_name, 'E0062', 0, true);
}
// Fetch last paid block information
if ($iLastBlockId = $setting->getValue('last_accounted_block_id')) {
$aLastAccountedBlock = $block->getBlockById($iLastBlockId);
} else {

View File

@ -65,4 +65,5 @@ $aErrorCodes['E0058'] = 'Worker name and/or password must not be empty';
$aErrorCodes['E0059'] = 'Worker already exists';
$aErrorCodes['E0060'] = 'Failed to add new worker';
$aErrorCodes['E0061'] = 'Failed to delete worker';
$aErrorCodes['E0062'] = 'Block has no share_id, not running payouts';
?>