[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");
|
$log->logInfo("\tUserID\tUsername\tBalance\tThreshold\tAddress");
|
||||||
foreach ($users as $aUserData) {
|
foreach ($users as $aUserData) {
|
||||||
$dBalance = $aUserData['confirmed'];
|
$dBalance = $aUserData['confirmed'];
|
||||||
$log->logInfo("\t" . $aUserData['id'] . "\t" . $aUserData['username'] . "\t" . $dBalance . "\t" . $aUserData['ap_threshold'] . "\t\t" . $aUserData['coin_address']);
|
// Validate address against RPC
|
||||||
// Only run if balance meets threshold and can pay the potential transaction fee
|
try {
|
||||||
if ($dBalance > $aUserData['ap_threshold'] && $dBalance > $config['txfee_auto']) {
|
|
||||||
// Validate address against RPC
|
|
||||||
try {
|
|
||||||
$aStatus = $bitcoin->validateaddress($aUserData['coin_address']);
|
$aStatus = $bitcoin->validateaddress($aUserData['coin_address']);
|
||||||
if (!$aStatus['isvalid']) {
|
if (!$aStatus['isvalid']) {
|
||||||
$log->logError('Failed to verify this users coin address, skipping payout');
|
$log->logError('Failed to verify this users coin address, skipping payout');
|
||||||
continue;
|
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
|
// Send balance, fees are reduced later by RPC Server
|
||||||
try {
|
try {
|
||||||
$txid = $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance - $config['txfee_auto']);
|
$txid = $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance - $config['txfee_auto']);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user