diff --git a/cronjobs/blockupdate.php b/cronjobs/blockupdate.php index cc94ccbe..bc5d4913 100755 --- a/cronjobs/blockupdate.php +++ b/cronjobs/blockupdate.php @@ -33,8 +33,9 @@ if ( $bitcoin->can_connect() !== true ) { // Fetch all unconfirmed blocks $aAllBlocks = $block->getAllUnconfirmed(max($config['network_confirmations'],$config['confirmations'])); -$log->logInfo("ID\tHeight\tBlockhash\tConfirmations"); +$header = false; foreach ($aAllBlocks as $iIndex => $aBlock) { + !$header ? $log->logInfo("ID\tHeight\tBlockhash\tConfirmations") : $header = true; $aBlockInfo = $bitcoin->getblock($aBlock['blockhash']); // Fetch this blocks transaction details to find orphan blocks $aTxDetails = $bitcoin->gettransaction($aBlockInfo['tx'][0]); diff --git a/cronjobs/findblock.php b/cronjobs/findblock.php index 18d97899..94a05fde 100755 --- a/cronjobs/findblock.php +++ b/cronjobs/findblock.php @@ -42,12 +42,13 @@ if ( $bitcoin->can_connect() === true ){ if (empty($aTransactions['transactions'])) { $log->logDebug('No new RPC transactions since last block'); } else { - // Table header - $log->logInfo("Blockhash\t\tHeight\tAmount\tConfirmations\tDiff\t\tTime"); - + $header = false; // Let us add those blocks as unaccounted foreach ($aTransactions['transactions'] as $iIndex => $aData) { if ( $aData['category'] == 'generate' || $aData['category'] == 'immature' ) { + // Table header, printe once if we found a block + !$header ? $log->logInfo("Blockhash\t\tHeight\tAmount\tConfirmations\tDiff\t\tTime") : $header = true; + $aBlockRPCInfo = $bitcoin->getblock($aData['blockhash']); $config['reward_type'] == 'block' ? $aData['amount'] = $aData['amount'] : $aData['amount'] = $config['reward']; $aData['height'] = $aBlockRPCInfo['height']; diff --git a/cronjobs/notifications.php b/cronjobs/notifications.php index 1c9dbd3d..7baf5bf1 100755 --- a/cronjobs/notifications.php +++ b/cronjobs/notifications.php @@ -33,9 +33,9 @@ $log->logDebug(" IDLE Worker Notifications ..."); // Find all IDLE workers $aWorkers = $worker->getAllIdleWorkers(); if (empty($aWorkers)) { - $log->logDebug(" no idle workers found\n"); + $log->logDebug(" no idle workers found"); } else { - $log->logInfo(" found " . count($aWorkers) . " IDLE workers\n"); + $log->logInfo(" found " . count($aWorkers) . " IDLE workers"); foreach ($aWorkers as $aWorker) { $aData = $aWorker; $aData['username'] = $user->getUserName($aWorker['account_id']); @@ -44,7 +44,7 @@ if (empty($aWorkers)) { $aData['email'] = $user->getUserEmail($aData['username']); $log->logDebug(" " . $aWorker['username'] . "..."); if (!$notification->sendNotification($aWorker['account_id'], 'idle_worker', $aData)) - $log->logDebug(" Failed sending notifications: " . $notification->getCronError() . "\n"); + $log->logDebug(" Failed sending notifications: " . $notification->getCronError()); } } @@ -53,23 +53,23 @@ $log->logDebug(" Reset IDLE Worker Notifications ..."); // We notified, lets check which recovered $aNotifications = $notification->getAllActive('idle_worker'); if (!empty($aNotifications)) { - $log->logInfo(" found " . count($aNotifications) . " active notification(s)\n"); + $log->logInfo(" found " . count($aNotifications) . " active notification(s)"); foreach ($aNotifications as $aNotification) { $aData = json_decode($aNotification['data'], true); $aWorker = $worker->getWorker($aData['id']); $log->logDebug(" " . $aWorker['username'] . " ..."); if ($aWorker['hashrate'] > 0) { if ($notification->setInactive($aNotification['id'])) { - $log->logDebug(" updated #" . $aNotification['id'] . " for " . $aWorker['username'] . " as inactive\n"); + $log->logDebug(" updated #" . $aNotification['id'] . " for " . $aWorker['username'] . " as inactive"); } else { - $log->logError(" failed to update #" . $aNotification['id'] . " for " . $aWorker['username'] . "\n"); + $log->logError(" failed to update #" . $aNotification['id'] . " for " . $aWorker['username']); } } else { - $log->logDebug(" still inactive\n"); + $log->logDebug(" still inactive"); } } } else { - $log->logDebug(" no active IDLE worker notifications\n"); + $log->logDebug(" no active IDLE worker notifications"); } require_once('cron_end.inc.php');