Merge pull request #1944 from MPOS/development
[MASTER] Update from Development
This commit is contained in:
commit
885e9328bf
@ -29,47 +29,49 @@ if ($setting->getValue('disable_notifications') == 1) {
|
|||||||
$monitoring->endCronjob($cron_name, 'E0009', 0, true, false);
|
$monitoring->endCronjob($cron_name, 'E0009', 0, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$log->logDebug(" IDLE Worker Notifications ...");
|
if ($setting->getValue('notifications_disable_idle_worker') != 1) {
|
||||||
// Find all IDLE workers
|
$log->logDebug(" IDLE Worker Notifications ...");
|
||||||
$aWorkers = $worker->getAllIdleWorkers();
|
// Find all IDLE workers
|
||||||
if (empty($aWorkers)) {
|
$aWorkers = $worker->getAllIdleWorkers();
|
||||||
$log->logDebug(" no idle workers found");
|
if (empty($aWorkers)) {
|
||||||
} else {
|
$log->logDebug(" no idle workers found");
|
||||||
$log->logInfo(" found " . count($aWorkers) . " IDLE workers");
|
} else {
|
||||||
foreach ($aWorkers as $aWorker) {
|
$log->logInfo(" found " . count($aWorkers) . " IDLE workers");
|
||||||
$aData = $aWorker;
|
foreach ($aWorkers as $aWorker) {
|
||||||
$aData['username'] = $user->getUserName($aWorker['account_id']);
|
$aData = $aWorker;
|
||||||
$aData['subject'] = 'IDLE Worker : ' . $aWorker['username'];
|
$aData['username'] = $user->getUserName($aWorker['account_id']);
|
||||||
$aData['worker'] = $aWorker['username'];
|
$aData['subject'] = 'IDLE Worker : ' . $aWorker['username'];
|
||||||
$aData['email'] = $user->getUserEmail($aData['username']);
|
$aData['worker'] = $aWorker['username'];
|
||||||
$log->logDebug(" " . $aWorker['username'] . "...");
|
$aData['email'] = $user->getUserEmail($aData['username']);
|
||||||
if (!$notification->sendNotification($aWorker['account_id'], 'idle_worker', $aData))
|
$log->logDebug(" " . $aWorker['username'] . "...");
|
||||||
$log->logDebug(" Failed sending notifications: " . $notification->getCronError());
|
if (!$notification->sendNotification($aWorker['account_id'], 'idle_worker', $aData))
|
||||||
}
|
$log->logDebug(" Failed sending notifications: " . $notification->getCronError());
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$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)");
|
|
||||||
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");
|
|
||||||
} else {
|
|
||||||
$log->logError(" failed to update #" . $aNotification['id'] . " for " . $aWorker['username']);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$log->logDebug(" still inactive");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$log->logDebug(" no active IDLE worker notifications");
|
|
||||||
|
$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)");
|
||||||
|
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");
|
||||||
|
} else {
|
||||||
|
$log->logError(" failed to update #" . $aNotification['id'] . " for " . $aWorker['username']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$log->logDebug(" still inactive");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$log->logDebug(" no active IDLE worker notifications");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('cron_end.inc.php');
|
require_once('cron_end.inc.php');
|
||||||
|
|||||||
@ -181,8 +181,8 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Table header for account shares
|
// Table header for account shares
|
||||||
$strLogMask = "| %5.5s | %-15.15s | %15.15s | %15.15s | %12.12s | %20.20s | %20.20s | %20.20s |";
|
$strLogMask = "| %5.5s | %-15.15s | %15.15s | %15.15s | %12.12s | %15.15s | %15.15s | %15.15s | %15.15s |";
|
||||||
$log->logInfo(sprintf($strLogMask, 'ID', 'Username', 'Valid', 'Invalid', 'Percentage', 'Payout', 'Donation', 'Fee'));
|
$log->logInfo(sprintf($strLogMask, 'ID', 'Username', 'Valid', 'Invalid', 'Percentage', 'Payout', 'Donation', 'Fee', 'Bonus'));
|
||||||
|
|
||||||
// Loop through all accounts that have found shares for this round
|
// Loop through all accounts that have found shares for this round
|
||||||
foreach ($aTotalAccountShares as $key => $aData) {
|
foreach ($aTotalAccountShares as $key => $aData) {
|
||||||
@ -201,16 +201,28 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
// Defaults
|
// Defaults
|
||||||
$aData['fee' ] = 0;
|
$aData['fee' ] = 0;
|
||||||
$aData['donation'] = 0;
|
$aData['donation'] = 0;
|
||||||
|
$aData['pool_bonus'] = 0;
|
||||||
|
|
||||||
|
// Calculate pool fees
|
||||||
if ($config['fees'] > 0 && $aData['no_fees'] == 0)
|
if ($config['fees'] > 0 && $aData['no_fees'] == 0)
|
||||||
$aData['fee'] = round($config['fees'] / 100 * $aData['payout'], 8);
|
$aData['fee'] = round($config['fees'] / 100 * $aData['payout'], 8);
|
||||||
|
|
||||||
|
// Calculate pool bonus if it applies, will be paid from liquid assets!
|
||||||
|
if ($config['pool_bonus'] > 0) {
|
||||||
|
if ($config['pool_bonus_type'] == 'block') {
|
||||||
|
$aData['pool_bonus'] = round(( $config['pool_bonus'] / 100 ) * $dReward, 8);
|
||||||
|
} else {
|
||||||
|
$aData['pool_bonus'] = round(( $config['pool_bonus'] / 100 ) * $aData['payout'], 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate donation amount, fees not included
|
// Calculate donation amount, fees not included
|
||||||
$aData['donation'] = round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8);
|
$aData['donation'] = round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8);
|
||||||
|
|
||||||
// Verbose output of this users calculations
|
// Verbose output of this users calculations
|
||||||
$log->logInfo(
|
$log->logInfo(
|
||||||
sprintf($strLogMask, $aData['id'], $aData['username'], $aData['pplns_valid'], $aData['pplns_invalid'],
|
sprintf($strLogMask, $aData['id'], $aData['username'], $aData['pplns_valid'], $aData['pplns_invalid'],
|
||||||
number_format($aData['percentage'], 8), number_format($aData['payout'], 8), number_format($aData['donation'], 8), number_format($aData['fee'], 8)
|
number_format($aData['percentage'], 8), number_format($aData['payout'], 8), number_format($aData['donation'], 8), number_format($aData['fee'], 8), number_format($aData['pool_bonus'], 8)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -225,6 +237,10 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
if ($aData['donation'] > 0)
|
if ($aData['donation'] > 0)
|
||||||
if (!$transaction->addTransaction($aData['id'], $aData['donation'], 'Donation', $aBlock['id']))
|
if (!$transaction->addTransaction($aData['id'], $aData['donation'], 'Donation', $aBlock['id']))
|
||||||
$log->logFatal('Failed to insert new Donation transaction to database for ' . $aData['username'] . ': ' . $transaction->getCronError() . 'on block ' . $aBlock['id']);
|
$log->logFatal('Failed to insert new Donation transaction to database for ' . $aData['username'] . ': ' . $transaction->getCronError() . 'on block ' . $aBlock['id']);
|
||||||
|
// Add new bonus credit
|
||||||
|
if ($aData['pool_bonus'] > 0)
|
||||||
|
if (!$transaction->addTransaction($aData['id'], $aData['pool_bonus'], 'Bonus', $aBlock['id']))
|
||||||
|
$log->logFatal('Failed to insert new Bonus transaction to database for ' . $aData['username'] . ': ' . $transaction->getCronError());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add full round share statistics
|
// Add full round share statistics
|
||||||
|
|||||||
@ -40,8 +40,8 @@ if (empty($aAllBlocks)) {
|
|||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
// Table header for account shares
|
// Table header for account shares
|
||||||
$strLogMask = "| %10.10s | %-5.5s | %15.15s | %15.15s | %12.12s | %20.20s | %20.20s | %20.20s |";
|
$strLogMask = "| %10.10s | %-5.5s | %15.15s | %15.15s | %12.12s | %12.12s | %15.15s | %15.15s | %15.15s | %15.15s |";
|
||||||
$log->logInfo(sprintf($strLogMask, 'Block', 'ID', 'Username', 'Valid', 'Invalid', 'Percentage', 'Payout', 'Donation', 'Fee'));
|
$log->logInfo(sprintf($strLogMask, 'Block', 'ID', 'Username', 'Valid', 'Invalid', 'Percentage', 'Payout', 'Donation', 'Fee', 'Bonus'));
|
||||||
foreach ($aAllBlocks as $iIndex => $aBlock) {
|
foreach ($aAllBlocks as $iIndex => $aBlock) {
|
||||||
// If we have unaccounted blocks without share_ids, they might not have been inserted yet
|
// If we have unaccounted blocks without share_ids, they might not have been inserted yet
|
||||||
if (!$aBlock['share_id']) {
|
if (!$aBlock['share_id']) {
|
||||||
@ -86,18 +86,30 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
// Defaults
|
// Defaults
|
||||||
$aData['fee' ] = 0;
|
$aData['fee' ] = 0;
|
||||||
$aData['donation'] = 0;
|
$aData['donation'] = 0;
|
||||||
|
$aData['pool_bonus'] = 0;
|
||||||
$aData['percentage'] = round(( 100 / $iRoundShares ) * $aData['valid'], 8);
|
$aData['percentage'] = round(( 100 / $iRoundShares ) * $aData['valid'], 8);
|
||||||
$aData['payout'] = round(( $aData['percentage'] / 100 ) * $dReward, 8);
|
$aData['payout'] = round(( $aData['percentage'] / 100 ) * $dReward, 8);
|
||||||
|
|
||||||
|
// Calculate pool fees if they apply
|
||||||
if ($config['fees'] > 0 && $aData['no_fees'] == 0)
|
if ($config['fees'] > 0 && $aData['no_fees'] == 0)
|
||||||
$aData['fee'] = round($config['fees'] / 100 * $aData['payout'], 8);
|
$aData['fee'] = round($config['fees'] / 100 * $aData['payout'], 8);
|
||||||
|
|
||||||
|
// Calculate pool bonus if it applies, will be paid from liquid assets!
|
||||||
|
if ($config['pool_bonus'] > 0) {
|
||||||
|
if ($config['pool_bonus_type'] == 'block') {
|
||||||
|
$aData['pool_bonus'] = round(( $config['pool_bonus'] / 100 ) * $dReward, 8);
|
||||||
|
} else {
|
||||||
|
$aData['pool_bonus'] = round(( $config['pool_bonus'] / 100 ) * $aData['payout'], 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate donation amount, fees not included
|
// Calculate donation amount, fees not included
|
||||||
$aData['donation'] = round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8);
|
$aData['donation'] = round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8);
|
||||||
|
|
||||||
// Verbose output of this users calculations
|
// Verbose output of this users calculations
|
||||||
$log->logInfo(
|
$log->logInfo(
|
||||||
sprintf($strLogMask, $aBlock['height'], $aData['id'], $aData['username'], $aData['valid'], $aData['invalid'],
|
sprintf($strLogMask, $aBlock['height'], $aData['id'], $aData['username'], $aData['valid'], $aData['invalid'],
|
||||||
number_format($aData['percentage'], 8), number_format($aData['payout'], 8), number_format($aData['donation'], 8), number_format($aData['fee'], 8))
|
number_format($aData['percentage'], 8), number_format($aData['payout'], 8), number_format($aData['donation'], 8), number_format($aData['fee'], 8), number_format($aData['pool_bonus'], 8))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update user share statistics
|
// Update user share statistics
|
||||||
@ -114,6 +126,10 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
if ($aData['donation'] > 0)
|
if ($aData['donation'] > 0)
|
||||||
if (!$transaction->addTransaction($aData['id'], $aData['donation'], 'Donation', $aBlock['id']))
|
if (!$transaction->addTransaction($aData['id'], $aData['donation'], 'Donation', $aBlock['id']))
|
||||||
$log->logFatal('Failed to insert new Donation transaction to database for ' . $aData['username'] . ': ' . $transaction->getCronError());
|
$log->logFatal('Failed to insert new Donation transaction to database for ' . $aData['username'] . ': ' . $transaction->getCronError());
|
||||||
|
// Add new bonus credit
|
||||||
|
if ($aData['pool_bonus'] > 0)
|
||||||
|
if (!$transaction->addTransaction($aData['id'], $aData['pool_bonus'], 'Bonus', $aBlock['id']))
|
||||||
|
$log->logFatal('Failed to insert new Bonus transaction to database for ' . $aData['username'] . ': ' . $transaction->getCronError());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add block as accounted for into settings table
|
// Add block as accounted for into settings table
|
||||||
|
|||||||
@ -6,25 +6,27 @@ if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA'][
|
|||||||
$notice = array();
|
$notice = array();
|
||||||
$enotice = array();
|
$enotice = array();
|
||||||
$error = array();
|
$error = array();
|
||||||
|
|
||||||
// setup some basic stuff for checking - getuid/getpwuid not available on mac/windows
|
// setup some basic stuff for checking - getuid/getpwuid not available on mac/windows
|
||||||
$apache_user = 'unknown';
|
$apache_user = 'unknown';
|
||||||
if (substr_count(strtolower(PHP_OS), 'nix') > 0 || substr_count(strtolower(PHP_OS), 'linux') > 0) {
|
if (substr_count(strtolower(PHP_OS), 'nix') > 0 || substr_count(strtolower(PHP_OS), 'linux') > 0) {
|
||||||
$apache_user = (function_exists('posix_getuid')) ? posix_getuid() : 'unknown';
|
$apache_user = (function_exists('posix_getuid')) ? posix_getuid() : 'unknown';
|
||||||
$apache_user = (function_exists('posix_getpwuid')) ? posix_getpwuid($apache_user) : $apache_user;
|
$apache_user = (function_exists('posix_getpwuid')) ? posix_getpwuid($apache_user) : $apache_user;
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup checks
|
// setup checks
|
||||||
// logging
|
// logging
|
||||||
if ($config['logging']['enabled']) {
|
if ($config['logging']['enabled']) {
|
||||||
if (!is_writable($config['logging']['path'])) {
|
if (!is_writable($config['logging']['path'])) {
|
||||||
$error[] = "Logging is enabled but we can't write in the logging path";
|
$error[] = "Logging is enabled but we can't write in the logfile path";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if memcache isn't available but enabled in config -> error
|
// check if memcache isn't available but enabled in config -> error
|
||||||
if (!class_exists('Memcached') && $config['memcache']['enabled']) {
|
if (!class_exists('Memcached') && $config['memcache']['enabled']) {
|
||||||
$error[] = "You have memcache enabled in your config and it's not available. Install the package on your system.";
|
$error[] = "You have memcached enabled in your config and it's not available as a PHP module. Install the package on your system.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it's not enabled, test it if it exists, if it works -> error tell them to enable, -> otherwise notice it's disabled
|
// if it's not enabled, test it if it exists, if it works -> error tell them to enable, -> otherwise notice it's disabled
|
||||||
if (!$config['memcache']['enabled']) {
|
if (!$config['memcache']['enabled']) {
|
||||||
if (PHP_OS == 'WINNT') {
|
if (PHP_OS == 'WINNT') {
|
||||||
@ -38,16 +40,18 @@ if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA'][
|
|||||||
$memcache_test_get = @$memcache_test->get('test_mpos_setval');
|
$memcache_test_get = @$memcache_test->get('test_mpos_setval');
|
||||||
}
|
}
|
||||||
if (class_exists('Memcached') && $memcache_test_get == $randmctv) {
|
if (class_exists('Memcached') && $memcache_test_get == $randmctv) {
|
||||||
$error[] = "You have memcache disabled in the config and it's available & works! Enable it.";
|
$error[] = "You have memcache disabled in the config but it's available and works! Enable it for best performance.";
|
||||||
} else {
|
} else {
|
||||||
$notice[] = "Memcache is disabled; Almost every linux distro has packages for it, you should be using it if you can.";
|
$notice[] = "Memcache is disabled; Almost every linux distro has packages for it, you should be using it if you can.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if htaccess exists
|
// check if htaccess exists
|
||||||
if (!file_exists(BASEPATH.".htaccess")) {
|
if (!file_exists(BASEPATH.".htaccess")) {
|
||||||
$htaccess_link = "<a href='https://github.com/MPOS/php-mpos/blob/next/public/.htaccess'>.htaccess</a>";
|
$htaccess_link = "<a href='https://github.com/MPOS/php-mpos/blob/next/public/.htaccess'>.htaccess</a>";
|
||||||
$notice[] = "You don't seem to have a .htaccess in your public folder, if you're using apache set it up $htaccess_link";
|
$notice[] = "You don't seem to have a .htaccess in your public folder, if you're using Apache set it up: $htaccess_link";
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we can write templates/cache and templates/compile -> error
|
// check if we can write templates/cache and templates/compile -> error
|
||||||
if (!is_writable(THEME_DIR.'/cache')) {
|
if (!is_writable(THEME_DIR.'/cache')) {
|
||||||
$error[] = "templates/cache folder is not writable for uid {$apache_user['name']}";
|
$error[] = "templates/cache folder is not writable for uid {$apache_user['name']}";
|
||||||
@ -55,11 +59,13 @@ if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA'][
|
|||||||
if (!is_writable(THEME_DIR.'/compile')) {
|
if (!is_writable(THEME_DIR.'/compile')) {
|
||||||
$error[] = "templates/compile folder is not writable for uid {$apache_user['name']}";
|
$error[] = "templates/compile folder is not writable for uid {$apache_user['name']}";
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we can write the config files, we should NOT be able to -> error
|
// check if we can write the config files, we should NOT be able to -> error
|
||||||
if (is_writable(INCLUDE_DIR.'/config/global.inc.php') || is_writable(INCLUDE_DIR.'/config/global.inc.dist.php') ||
|
if (is_writable(INCLUDE_DIR.'/config/global.inc.php') || is_writable(INCLUDE_DIR.'/config/global.inc.dist.php') ||
|
||||||
is_writable(INCLUDE_DIR.'/config/security.inc.php') || is_writable(INCLUDE_DIR.'/config/security.inc.dist.php')) {
|
is_writable(INCLUDE_DIR.'/config/security.inc.php') || is_writable(INCLUDE_DIR.'/config/security.inc.dist.php')) {
|
||||||
$error[] = "Your config files <b>SHOULD NOT be writable to this user</b>!";
|
$error[] = "Your config files <b>SHOULD NOT be writable to this user</b>!";
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if daemon can connect -> error
|
// check if daemon can connect -> error
|
||||||
try {
|
try {
|
||||||
if ($bitcoin->can_connect() !== true) {
|
if ($bitcoin->can_connect() !== true) {
|
||||||
@ -76,7 +82,7 @@ if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA'][
|
|||||||
if (!$bitcoin->validateaddress($config['coldwallet']['address']))
|
if (!$bitcoin->validateaddress($config['coldwallet']['address']))
|
||||||
$error[] = "Your cold wallet address is <u>SET and INVALID</u>";
|
$error[] = "Your cold wallet address is <u>SET and INVALID</u>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if there is more than one account set on wallet
|
// check if there is more than one account set on wallet
|
||||||
$accounts = $bitcoin->listaccounts();
|
$accounts = $bitcoin->listaccounts();
|
||||||
if (count($accounts) > 1 && $accounts[''] <= 0) {
|
if (count($accounts) > 1 && $accounts[''] <= 0) {
|
||||||
@ -85,34 +91,30 @@ if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA'][
|
|||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
// if database connection fails -> error
|
// check anti DOS protection, we need memcache for that
|
||||||
$db_connect = new mysqli($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['port']);
|
|
||||||
if (mysqli_connect_errno() || !array_key_exists('client_info', $db_connect)) {
|
|
||||||
$error[] = "Unable to connect to mysql using provided credentials";
|
|
||||||
}
|
|
||||||
if ($config['mc_antidos'] && !$config['memcache']['enabled']) {
|
if ($config['mc_antidos'] && !$config['memcache']['enabled']) {
|
||||||
$error[] = "mc_antidos is enabled and memcache is not, <u>memcache is required</u> to use this";
|
$error[] = "mc_antidos is enabled and memcache is not, <u>memcache is required</u> to use this";
|
||||||
}
|
}
|
||||||
|
|
||||||
// poke stratum using gettingstarted details -> enotice
|
// poke stratum using gettingstarted details -> enotice
|
||||||
if (substr_count(strtolower(PHP_OS), 'nix') > 0) {
|
if (function_exists('socket_create')) {
|
||||||
// unix *poke*
|
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||||
$socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
|
||||||
if ($socket !== false) {
|
if ($socket !== false) {
|
||||||
$address = @gethostbyname($config['gettingstarted']['stratumurl']);
|
$address = @gethostbyname($config['gettingstarted']['stratumurl']);
|
||||||
$result = @socket_connect($socket, $address, $config['gettingstarted']['stratumport']);
|
$result = @socket_connect($socket, $address, $config['gettingstarted']['stratumport']);
|
||||||
if ($result !== true) {
|
if ($result !== true) {
|
||||||
$enotice[] = "We tried to poke your Stratum server using config->gettingstarted details but it didn't respond";
|
$enotice[] = 'We tried to poke your Stratum server using your $config[\'gettingstarted\'] settings but it didn\'t respond';
|
||||||
}
|
}
|
||||||
$close = @socket_close($socket);
|
$close = @socket_close($socket);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// mac/windows *poke*
|
// Connect via fsockopen as fallback
|
||||||
if (! $fp = @fsockopen($config['gettingstarted']['stratumurl'],$config['gettingstarted']['stratumport'],$errCode,$errStr,1)) {
|
if (! $fp = @fsockopen($config['gettingstarted']['stratumurl'], $config['gettingstarted']['stratumport'], $errCode, $errStr, 1)) {
|
||||||
$enotice[] = "We tried to poke your Stratum server using config->gettingstarted details but it didn't respond";
|
$enotice[] = 'We tried to poke your Stratum server using your $config[\'gettingstarted\'] settings but it didn\'t respond';
|
||||||
}
|
}
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// security checks
|
// security checks
|
||||||
// salts too short -> notice, salts default -> error
|
// salts too short -> notice, salts default -> error
|
||||||
if ((strlen($config['SALT']) < 24) || (strlen($config['SALTY']) < 24) || $config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
|
if ((strlen($config['SALT']) < 24) || (strlen($config['SALTY']) < 24) || $config['SALT'] == 'PLEASEMAKEMESOMETHINGRANDOM' || $config['SALTY'] == 'THISSHOULDALSOBERRAANNDDOOM') {
|
||||||
@ -122,7 +124,7 @@ if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA'][
|
|||||||
$notice[] = "SALT or SALTY is too short, they should be more than 24 characters and changing them will require registering again";
|
$notice[] = "SALT or SALTY is too short, they should be more than 24 characters and changing them will require registering again";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// display the errors
|
// display the errors
|
||||||
foreach ($enotice as $en) {
|
foreach ($enotice as $en) {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => $en, 'TYPE' => 'info');
|
$_SESSION['POPUP'][] = array('CONTENT' => $en, 'TYPE' => 'info');
|
||||||
|
|||||||
@ -3,6 +3,21 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
|||||||
|
|
||||||
class Setting extends Base {
|
class Setting extends Base {
|
||||||
protected $table = 'settings';
|
protected $table = 'settings';
|
||||||
|
private $cache = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch all values available and cache them in this class
|
||||||
|
* That way we don't fetch them from DB for each call
|
||||||
|
*/
|
||||||
|
public function createCache() {
|
||||||
|
if ($aSettings = $this->getAllAssoc()) {
|
||||||
|
foreach ($aSettings as $key => $aData) {
|
||||||
|
$this->cache[$aData['name']] = $aData['value'];
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch a value from our table
|
* Fetch a value from our table
|
||||||
@ -10,6 +25,8 @@ class Setting extends Base {
|
|||||||
* @return value string Value
|
* @return value string Value
|
||||||
**/
|
**/
|
||||||
public function getValue($name, $default="") {
|
public function getValue($name, $default="") {
|
||||||
|
// Try our class cache first
|
||||||
|
if (isset($this->cache[$name])) return $this->cache[$name];
|
||||||
$stmt = $this->mysqli->prepare("SELECT value FROM $this->table WHERE name = ? LIMIT 1");
|
$stmt = $this->mysqli->prepare("SELECT value FROM $this->table WHERE name = ? LIMIT 1");
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param('s', $name) && $stmt->execute() && $result = $stmt->get_result()) {
|
if ($this->checkStmt($stmt) && $stmt->bind_param('s', $name) && $stmt->execute() && $result = $stmt->get_result()) {
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
@ -30,6 +47,8 @@ class Setting extends Base {
|
|||||||
* @return bool
|
* @return bool
|
||||||
**/
|
**/
|
||||||
public function setValue($name, $value) {
|
public function setValue($name, $value) {
|
||||||
|
// Update local cache too
|
||||||
|
$this->cache[$name] = $value;
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
INSERT INTO $this->table (name, value)
|
INSERT INTO $this->table (name, value)
|
||||||
VALUES (?, ?)
|
VALUES (?, ?)
|
||||||
@ -44,3 +63,5 @@ $setting = new Setting($debug, $mysqli);
|
|||||||
$setting->setDebug($debug);
|
$setting->setDebug($debug);
|
||||||
$setting->setMysql($mysqli);
|
$setting->setMysql($mysqli);
|
||||||
$setting->setErrorCodes($aErrorCodes);
|
$setting->setErrorCodes($aErrorCodes);
|
||||||
|
// Fill our class cache with data so we don't have to run SQL queries all the time
|
||||||
|
$setting->createCache();
|
||||||
|
|||||||
@ -469,7 +469,7 @@ class Statistics extends Base {
|
|||||||
share_id,
|
share_id,
|
||||||
IF(difficulty = 0, POW(2, (" . $this->config['difficulty'] . " - 16)), difficulty) AS difficulty,
|
IF(difficulty = 0, POW(2, (" . $this->config['difficulty'] . " - 16)), difficulty) AS difficulty,
|
||||||
username
|
username
|
||||||
FROM shares_archive
|
FROM " . $this->share->getArchiveTableName() . "
|
||||||
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) AND our_result = 'Y'
|
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) AND our_result = 'Y'
|
||||||
) AS t1
|
) AS t1
|
||||||
LEFT JOIN " . $this->user->getTableName() . " AS a
|
LEFT JOIN " . $this->user->getTableName() . " AS a
|
||||||
|
|||||||
@ -55,6 +55,8 @@ class Tools extends Base {
|
|||||||
return 'btce';
|
return 'btce';
|
||||||
} else if (preg_match('/cryptsy.com/', $url)) {
|
} else if (preg_match('/cryptsy.com/', $url)) {
|
||||||
return 'cryptsy';
|
return 'cryptsy';
|
||||||
|
} else if (preg_match('/cryptorush.in/', $url)) {
|
||||||
|
return 'cryptorush';
|
||||||
}
|
}
|
||||||
$this->setErrorMessage("API URL unknown");
|
$this->setErrorMessage("API URL unknown");
|
||||||
return false;
|
return false;
|
||||||
@ -84,6 +86,9 @@ class Tools extends Base {
|
|||||||
case 'cryptsy':
|
case 'cryptsy':
|
||||||
return @$aData['return']['markets'][$strCurrency]['lasttradeprice'];
|
return @$aData['return']['markets'][$strCurrency]['lasttradeprice'];
|
||||||
break;
|
break;
|
||||||
|
case 'cryptorush':
|
||||||
|
return @$aData["$strCurrency/" . $this->config['price']['target']]['last_trade'];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->setErrorMessage("Got an invalid response from ticker API");
|
$this->setErrorMessage("Got an invalid response from ticker API");
|
||||||
|
|||||||
@ -425,3 +425,10 @@ $aSettings['notifications'][] = array(
|
|||||||
'name' => 'notifications_disable_block', 'value' => $setting->getValue('notifications_disable_block'),
|
'name' => 'notifications_disable_block', 'value' => $setting->getValue('notifications_disable_block'),
|
||||||
'tooltip' => 'Enable/Disable block notifications globally. Will remove the user option too.'
|
'tooltip' => 'Enable/Disable block notifications globally. Will remove the user option too.'
|
||||||
);
|
);
|
||||||
|
$aSettings['notifications'][] = array(
|
||||||
|
'display' => 'Disable IDLE Worker Notifications', 'type' => 'select',
|
||||||
|
'options' => array( 0 => 'No', 1 => 'Yes'),
|
||||||
|
'default' => 0,
|
||||||
|
'name' => 'notifications_disable_idle_worker', 'value' => $setting->getValue('notifications_disable_idle_worker'),
|
||||||
|
'tooltip' => 'Enable/Disable IDLE worker notifications globally. Will remove the user option too.'
|
||||||
|
);
|
||||||
|
|||||||
@ -128,12 +128,14 @@ $config['txfee_auto'] = 0.1;
|
|||||||
$config['txfee_manual'] = 0.1;
|
$config['txfee_manual'] = 0.1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block Bonus
|
* Block & Pool Bonus
|
||||||
* Bonus in coins of block bonus
|
* Bonus coins for blockfinder or a pool bonus for everyone
|
||||||
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-block-bonus
|
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-block-bonus
|
||||||
|
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pool-bonus
|
||||||
*/
|
*/
|
||||||
$config['block_bonus'] = 0;
|
$config['block_bonus'] = 0;
|
||||||
|
$config['pool_bonus'] = 0;
|
||||||
|
$config['pool_bonus_type'] = 'payout';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payout System
|
* Payout System
|
||||||
|
|||||||
@ -24,6 +24,7 @@ if ($user->isAuthenticated()) {
|
|||||||
|
|
||||||
// Fetch global settings
|
// Fetch global settings
|
||||||
$smarty->assign('DISABLE_BLOCKNOTIFICATIONS', $setting->getValue('notifications_disable_block'));
|
$smarty->assign('DISABLE_BLOCKNOTIFICATIONS', $setting->getValue('notifications_disable_block'));
|
||||||
|
$smarty->assign('DISABLE_IDLEWORKERNOTIFICATIONS', $setting->getValue('notifications_disable_idle_worker'));
|
||||||
|
|
||||||
// Fetch user notification settings
|
// Fetch user notification settings
|
||||||
$aSettings = $notification->getNotificationSettings($_SESSION['USERDATA']['id']);
|
$aSettings = $notification->getNotificationSettings($_SESSION['USERDATA']['id']);
|
||||||
|
|||||||
@ -40,6 +40,7 @@ if ($user->isAuthenticated()) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$smarty->assign('DISABLE_IDLEWORKERNOTIFICATIONS', $setting->getValue('notifications_disable_idle_worker'));
|
||||||
$aWorkers = $worker->getWorkers($_SESSION['USERDATA']['id']);
|
$aWorkers = $worker->getWorkers($_SESSION['USERDATA']['id']);
|
||||||
if (!$aWorkers) $_SESSION['POPUP'][] = array('CONTENT' => 'You have no workers configured', 'TYPE' => 'errormsg');
|
if (!$aWorkers) $_SESSION['POPUP'][] = array('CONTENT' => 'You have no workers configured', 'TYPE' => 'errormsg');
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@ empty($_REQUEST['start']) ? $start = 0 : $start = $_REQUEST['start'];
|
|||||||
|
|
||||||
$aWorkers = $worker->getAllWorkers($iLimit, $interval, $start);
|
$aWorkers = $worker->getAllWorkers($iLimit, $interval, $start);
|
||||||
|
|
||||||
|
$smarty->assign('DISABLE_IDLEWORKERNOTIFICATIONS', $setting->getValue('notifications_disable_idle_worker'));
|
||||||
$smarty->assign('LIMIT', $iLimit);
|
$smarty->assign('LIMIT', $iLimit);
|
||||||
$smarty->assign('WORKERS', $aWorkers);
|
$smarty->assign('WORKERS', $aWorkers);
|
||||||
$smarty->assign('CONTENT', 'default.tpl');
|
$smarty->assign('CONTENT', 'default.tpl');
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
<th align="left">Type</th>
|
<th align="left">Type</th>
|
||||||
<th align="center">Active</th>
|
<th align="center">Active</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
{if $DISABLE_IDLEWORKERNOTIFICATIONS|default:"" != 1}
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left">IDLE Worker</td>
|
<td align="left">IDLE Worker</td>
|
||||||
<td>
|
<td>
|
||||||
@ -25,6 +26,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{/if}
|
||||||
{if $DISABLE_BLOCKNOTIFICATIONS|default:"" != 1}
|
{if $DISABLE_BLOCKNOTIFICATIONS|default:"" != 1}
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left">New Blocks</td>
|
<td align="left">New Blocks</td>
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
<th align="left">Worker Login</th>
|
<th align="left">Worker Login</th>
|
||||||
<th align="left">Worker Password</th>
|
<th align="left">Worker Password</th>
|
||||||
<th align="center">Active</th>
|
<th align="center">Active</th>
|
||||||
{if $GLOBAL.config.disable_notifications != 1}<th align="center">Monitor</th>{/if}
|
{if $GLOBAL.config.disable_notifications != 1 && $DISABLE_IDLEWORKERNOTIFICATIONS != 1}<th align="center">Monitor</th>{/if}
|
||||||
<th align="right">Khash/s</th>
|
<th align="right">Khash/s</th>
|
||||||
<th align="right">Difficulty</th>
|
<th align="right">Difficulty</th>
|
||||||
<th align="center" style="padding-right: 25px;">Action</th>
|
<th align="center" style="padding-right: 25px;">Action</th>
|
||||||
@ -51,7 +51,7 @@
|
|||||||
<td align="left"{if $WORKERS[worker].hashrate > 0} style="color: orange"{/if}>{$username.0|escape}.<input name="data[{$WORKERS[worker].id}][username]" value="{$username.1|escape}" size="10" required/></td>
|
<td align="left"{if $WORKERS[worker].hashrate > 0} style="color: orange"{/if}>{$username.0|escape}.<input name="data[{$WORKERS[worker].id}][username]" value="{$username.1|escape}" size="10" required/></td>
|
||||||
<td align="left"><input type="text" name="data[{$WORKERS[worker].id}][password]" value="{$WORKERS[worker].password|escape}" size="10" required></td>
|
<td align="left"><input type="text" name="data[{$WORKERS[worker].id}][password]" value="{$WORKERS[worker].password|escape}" size="10" required></td>
|
||||||
<td align="center"><i class="icon-{if $WORKERS[worker].hashrate > 0}ok{else}cancel{/if}"></i></td>
|
<td align="center"><i class="icon-{if $WORKERS[worker].hashrate > 0}ok{else}cancel{/if}"></i></td>
|
||||||
{if $GLOBAL.config.disable_notifications != 1}
|
{if $GLOBAL.config.disable_notifications != 1 && $DISABLE_IDLEWORKERNOTIFICATIONS != 1}
|
||||||
<td>
|
<td>
|
||||||
<span class="toggle">
|
<span class="toggle">
|
||||||
<label for="data[{$WORKERS[worker].id}][monitor]">
|
<label for="data[{$WORKERS[worker].id}][monitor]">
|
||||||
|
|||||||
@ -25,8 +25,8 @@
|
|||||||
<th align="left">Worker Name</th>
|
<th align="left">Worker Name</th>
|
||||||
<th align="left">Password</th>
|
<th align="left">Password</th>
|
||||||
<th align="center">Active</th>
|
<th align="center">Active</th>
|
||||||
{if $GLOBAL.config.disable_notifications != 1}<th align="center">Monitor</th>{/if}
|
|
||||||
<th align="right">Khash/s</th>
|
<th align="right">Khash/s</th>
|
||||||
|
{if $GLOBAL.config.disable_notifications != 1 && $DISABLE_IDLEWORKERNOTIFICATIONS != 1}<th align="center">Monitor</th>{/if}
|
||||||
<th align="right">Difficulty</th>
|
<th align="right">Difficulty</th>
|
||||||
<th align="right" style="padding-right: 25px;">Avg Difficulty</th>
|
<th align="right" style="padding-right: 25px;">Avg Difficulty</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
<td align="left">{$WORKERS[worker].username|escape}</td>
|
<td align="left">{$WORKERS[worker].username|escape}</td>
|
||||||
<td align="left">{$WORKERS[worker].password|escape}</td>
|
<td align="left">{$WORKERS[worker].password|escape}</td>
|
||||||
<td align="center"><i class="icon-{if $WORKERS[worker].hashrate > 0}ok{else}cancel{/if}"></i></td>
|
<td align="center"><i class="icon-{if $WORKERS[worker].hashrate > 0}ok{else}cancel{/if}"></i></td>
|
||||||
{if $GLOBAL.config.disable_notifications != 1}
|
{if $GLOBAL.config.disable_notifications != 1 && $DISABLE_IDLEWORKERNOTIFICATIONS != 1}
|
||||||
<td align="center"><i class="icon-{if $WORKERS[worker].monitor}ok{else}cancel{/if}"></i></td>
|
<td align="center"><i class="icon-{if $WORKERS[worker].monitor}ok{else}cancel{/if}"></i></td>
|
||||||
{/if}
|
{/if}
|
||||||
<td align="right">{$WORKERS[worker].hashrate|number_format|default:"0"}</td>
|
<td align="right">{$WORKERS[worker].hashrate|number_format|default:"0"}</td>
|
||||||
|
|||||||
@ -29,9 +29,20 @@ chdir(dirname(__FILE__));
|
|||||||
// Include all settings and classes
|
// Include all settings and classes
|
||||||
require_once('shared.inc.php');
|
require_once('shared.inc.php');
|
||||||
// Command line options
|
// Command line options
|
||||||
$options = getopt("l:r:");
|
$options = getopt("hvl:r:t:");
|
||||||
isset($options['l']) ? $limit = (int)$options['l'] : $limit = (int)1000;
|
isset($options['l']) ? $limit = (int)$options['l'] : $limit = (int)1000;
|
||||||
isset($options['r']) ? $rpclimit = (int)$options['r'] : $rpclimit = (int)10000;
|
isset($options['r']) ? $rpclimit = (int)$options['r'] : $rpclimit = (int)10000;
|
||||||
|
isset($options['t']) ? $customtxfee = (float)$options['t'] : $customtxfee = (float)0.1;
|
||||||
|
isset($options['v']) ? $verbose = true : $verbose = false;
|
||||||
|
if (isset($options['h'])) {
|
||||||
|
echo "Usage " . basename($argv[0]) . " [-l #] [-c #]:" . PHP_EOL;
|
||||||
|
echo " -h : Show this help" . PHP_EOL;
|
||||||
|
echo " -v : Verbose mode, will show RPC transactions not matched against DB" . PHP_EOL;
|
||||||
|
echo " -l # : Limit to # last database debit AP/MP transactions, default 1000" . PHP_EOL;
|
||||||
|
echo " -c # : Limit to # last transactions, default 10000" . PHP_EOL;
|
||||||
|
echo " -t # : Check against a custom TX Fee too, default 0.1" . PHP_EOL;
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch and merge MP and AP payouts
|
// Fetch and merge MP and AP payouts
|
||||||
$aAllMPDebitTxs = $transaction->getTransactions(0, array('type' => 'Debit_MP'), $limit);
|
$aAllMPDebitTxs = $transaction->getTransactions(0, array('type' => 'Debit_MP'), $limit);
|
||||||
@ -50,6 +61,7 @@ foreach ($aListTransactions as $key => $aTransaction) {
|
|||||||
|
|
||||||
// Initilize counters
|
// Initilize counters
|
||||||
$total=count($aListTransactions);
|
$total=count($aListTransactions);
|
||||||
|
$aMissingRPCMatches = array();
|
||||||
$found=0;
|
$found=0;
|
||||||
$notfound=0;
|
$notfound=0;
|
||||||
|
|
||||||
@ -67,6 +79,7 @@ foreach ($aAllDebitTxs as $aDebitTx) {
|
|||||||
((string)($aTransaction['amount'] + $aTransaction['fee']) == (string)($aDebitTx['amount'] * -1) || // Check against transaction - Fee total
|
((string)($aTransaction['amount'] + $aTransaction['fee']) == (string)($aDebitTx['amount'] * -1) || // Check against transaction - Fee total
|
||||||
(string)($aTransaction['amount'] + $config['txfee_manual']) == (string)($aDebitTx['amount'] * -1) || // Check against txfee_manual deducted
|
(string)($aTransaction['amount'] + $config['txfee_manual']) == (string)($aDebitTx['amount'] * -1) || // Check against txfee_manual deducted
|
||||||
(string)($aTransaction['amount'] + $config['txfee_auto']) == (string)($aDebitTx['amount'] * -1) || // Check against txfee_auto deducted
|
(string)($aTransaction['amount'] + $config['txfee_auto']) == (string)($aDebitTx['amount'] * -1) || // Check against txfee_auto deducted
|
||||||
|
(string)($aTransaction['amount'] + $customtxfee) == (string)($aDebitTx['amount'] * -1) || // Check against transaction - default fee in MPOS
|
||||||
(string)$aTransaction['amount'] == (string)($aDebitTx['amount'] * -1)) // Check against actual value
|
(string)$aTransaction['amount'] == (string)($aDebitTx['amount'] * -1)) // Check against actual value
|
||||||
) {
|
) {
|
||||||
unset($aListTransactions[$key]);
|
unset($aListTransactions[$key]);
|
||||||
@ -76,12 +89,39 @@ foreach ($aAllDebitTxs as $aDebitTx) {
|
|||||||
$txid = $aTransaction['txid'];
|
$txid = $aTransaction['txid'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$bFound) $status = 'MISSING';
|
if (!$bFound) {
|
||||||
|
$status = 'MISSING';
|
||||||
|
$aMissingRPCMatches[] = $aDebitTx;
|
||||||
|
}
|
||||||
printf($mask, $aDebitTx['id'], $aDebitTx['username'], $aDebitTx['coin_address'], $aDebitTx['amount'], $status, $txid);
|
printf($mask, $aDebitTx['id'], $aDebitTx['username'], $aDebitTx['coin_address'], $aDebitTx['amount'], $status, $txid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Small summary
|
// Small summary
|
||||||
echo PHP_EOL . 'Summary: ' . PHP_EOL;
|
echo PHP_EOL . 'Please be aware that transaction prior to a transaction fee change may be marked as MISSING.' . PHP_EOL;
|
||||||
echo ' Total Send TX Records: ' . $total . PHP_EOL;
|
echo 'See help on how to apply a custom transaction fee that can also be checked against. You can also enable verbose mode.' . PHP_EOL;
|
||||||
echo ' Total Debit Records: ' . count($aAllDebitTxs) . PHP_EOL;
|
echo PHP_EOL . 'Summary' . PHP_EOL;
|
||||||
echo ' Total Records Found: ' . $found . PHP_EOL;
|
echo ' DB Debit Transaction Limit: ' . $limit . PHP_EOL;
|
||||||
|
echo ' RPC Transaction Limit: ' . $rpclimit . PHP_EOL;
|
||||||
|
echo ' Custom TX Fee Checked: ' . $customtxfee . PHP_EOL;
|
||||||
|
echo ' Total Send TX Records: ' . $total . PHP_EOL;
|
||||||
|
echo ' Total Debit Records: ' . count($aAllDebitTxs) . PHP_EOL;
|
||||||
|
echo ' Total Records Found: ' . $found . PHP_EOL;
|
||||||
|
|
||||||
|
if ($verbose) {
|
||||||
|
if (count($aListTransactions) > 0) {
|
||||||
|
$mask = "| %-40.40s | %-15.15s | %-65.65s |" . PHP_EOL;
|
||||||
|
echo PHP_EOL . 'Here a list of RPC transactions that have not matched any DB records:' . PHP_EOL . PHP_EOL;
|
||||||
|
printf($mask, 'Address', 'Amount', 'TX ID');
|
||||||
|
foreach ($aListTransactions as $aTransaction) {
|
||||||
|
printf($mask, $aTransaction['address'], $aTransaction['amount'], $aTransaction['txid']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($aMissingRPCMatches) > 0) {
|
||||||
|
$mask = "| %-40.40s | %-15.15s | %-8.8s | %-35.35s |" . PHP_EOL;
|
||||||
|
echo PHP_EOL . 'Here a list of DB transactions that have not matched any RPC records:' . PHP_EOL . PHP_EOL;
|
||||||
|
printf($mask, 'Address', 'Amount', 'DB ID', 'Username');
|
||||||
|
foreach ($aMissingRPCMatches as $aDebitTx) {
|
||||||
|
printf($mask, $aDebitTx['coin_address'], $aDebitTx['amount'], $aDebitTx['id'], $aDebitTx['username']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user