[FIX] moved before balance check
This commit is contained in:
parent
71519d14d6
commit
10ad4eecdd
@ -117,20 +117,20 @@ if ($setting->getValue('disable_auto_payouts') != 1) {
|
||||
$log->logInfo("\tUserID\tUsername\tBalance\tThreshold\tAddress");
|
||||
foreach ($users as $aUserData) {
|
||||
$dBalance = $aUserData['confirmed'];
|
||||
$log->logInfo("\t" . $aUserData['id'] . "\t" . $aUserData['username'] . "\t" . $dBalance . "\t" . $aUserData['ap_threshold'] . "\t\t" . $aUserData['coin_address']);
|
||||
// Only run if balance meets threshold and can pay the potential transaction fee
|
||||
if ($dBalance > $aUserData['ap_threshold'] && $dBalance > $config['txfee_auto']) {
|
||||
// Validate address against RPC
|
||||
try {
|
||||
// Validate address against RPC
|
||||
try {
|
||||
$aStatus = $bitcoin->validateaddress($aUserData['coin_address']);
|
||||
if (!$aStatus['isvalid']) {
|
||||
$log->logError('Failed to verify this users coin address, skipping payout');
|
||||
continue;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$log->logError('Failed to verify this users coin address, skipping payout');
|
||||
continue;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$log->logError('Failed to verify this users coin address, skipping payout');
|
||||
continue;
|
||||
}
|
||||
$log->logInfo("\t" . $aUserData['id'] . "\t" . $aUserData['username'] . "\t" . $dBalance . "\t" . $aUserData['ap_threshold'] . "\t\t" . $aUserData['coin_address']);
|
||||
// Only run if balance meets threshold and can pay the potential transaction fee
|
||||
if ($dBalance > $aUserData['ap_threshold'] && $dBalance > $config['txfee_auto']) {
|
||||
// Send balance, fees are reduced later by RPC Server
|
||||
try {
|
||||
$txid = $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance - $config['txfee_auto']);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user