payments: handle payout_max field, to enhance later

This commit is contained in:
Tanguy Pruvot 2016-04-26 15:36:48 +02:00
parent e0d65b0fad
commit c74cfff0fc

View file

@ -51,8 +51,8 @@ function BackendCoinPayments($coin)
$users = getdbolist('db_accounts', "balance>$min_payout and coinid={$coin->id}");
// todo: db field
if($coin->symbol == 'MUE' || $coin->symbol == 'BOD' || $coin->symbol == 'DIME' || $coin->symbol == 'BTCRY')
// todo: enhance/detect payout_max from normal sendmany error
if($coin->symbol == 'MUE' || $coin->symbol == 'BOD' || $coin->symbol == 'DIME' || $coin->symbol == 'BTCRY' || !empty($coin->payout_max))
{
foreach($users as $user)
{
@ -69,6 +69,9 @@ function BackendCoinPayments($coin)
debuglog("error $remote->error, $user->username, $amount");
if($remote->error == 'transaction too large' || $remote->error == 'invalid amount')
{
$coin->payout_max = min((double) $amount, (double) $coin->payout_max);
$coin->save();
$amount /= 2;
continue;
}