Fixing manual payout race condition
* Mark manual payout active * Run payout logics * Reset manual payout This ensures only one manual transaction can be run at a time. If any users starts a manual payout others have to wait until the site completed loading and finished the transaction process. As long as we don't have too many users doing a manual payout at the same time this should not be an issue. Best for users is using auto payouts anyway. This addresses #149
This commit is contained in:
parent
463f199040
commit
b1f3c9bece
@ -13,6 +13,10 @@ if ( ! $user->checkPin($_SESSION['USERDATA']['id'], $_POST['authPin']) && $_POST
|
|||||||
} else {
|
} else {
|
||||||
switch ($_POST['do']) {
|
switch ($_POST['do']) {
|
||||||
case 'cashOut':
|
case 'cashOut':
|
||||||
|
if ($setting->getValue('manual_payout_active') == 1) {
|
||||||
|
$_SESSION['POPUP'][] = array('CONTENT' => 'A manual payout is in progress. Please try again later.', 'TYPE' => 'errormsg');
|
||||||
|
} else {
|
||||||
|
$setting->setValue('manual_payout_active', 1);
|
||||||
$continue = true;
|
$continue = true;
|
||||||
$dBalance = $transaction->getBalance($_SESSION['USERDATA']['id']);
|
$dBalance = $transaction->getBalance($_SESSION['USERDATA']['id']);
|
||||||
$sCoinAddress = $user->getCoinAddress($_SESSION['USERDATA']['id']);
|
$sCoinAddress = $user->getCoinAddress($_SESSION['USERDATA']['id']);
|
||||||
@ -53,6 +57,8 @@ if ( ! $user->checkPin($_SESSION['USERDATA']['id'], $_POST['authPin']) && $_POST
|
|||||||
} else {
|
} else {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Insufficient funds, you need more than 0.1 LTC to cover transaction fees', 'TYPE' => 'errormsg');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Insufficient funds, you need more than 0.1 LTC to cover transaction fees', 'TYPE' => 'errormsg');
|
||||||
}
|
}
|
||||||
|
$setting->setValue('manual_payout_active', 0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'updateAccount':
|
case 'updateAccount':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user