Merge pull request #154 from TheSerapher/issue-149

Fixing manual payout race condition, fixes #149
This commit is contained in:
Sebastian Grewe 2013-06-10 01:41:47 -07:00
commit 4c20a84fb9

View File

@ -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':