Merge pull request #1782 from MPOS/payout-tx-limit
[ADDED] Payout Queue Limiter
This commit is contained in:
commit
63a6672cd2
@ -45,7 +45,7 @@ if (!$dWalletBalance = $bitcoin->getrealbalance())
|
|||||||
$dWalletBalance = 0;
|
$dWalletBalance = 0;
|
||||||
|
|
||||||
// Fetch outstanding manual-payouts
|
// Fetch outstanding manual-payouts
|
||||||
$aManualPayouts = $transaction->getMPQueue();
|
$aManualPayouts = $transaction->getMPQueue($config['payout']['txlimit_manual']);
|
||||||
|
|
||||||
// Fetch our manual payouts, process them
|
// Fetch our manual payouts, process them
|
||||||
if ($setting->getValue('disable_manual_payouts') != 1 && $aManualPayouts) {
|
if ($setting->getValue('disable_manual_payouts') != 1 && $aManualPayouts) {
|
||||||
@ -117,7 +117,7 @@ if (!$dWalletBalance = $bitcoin->getrealbalance())
|
|||||||
$dWalletBalance = 0;
|
$dWalletBalance = 0;
|
||||||
|
|
||||||
// Fetch outstanding auto-payouts
|
// Fetch outstanding auto-payouts
|
||||||
$aAutoPayouts = $transaction->getAPQueue();
|
$aAutoPayouts = $transaction->getAPQueue($config['payout']['txlimit_auto']);
|
||||||
|
|
||||||
// Fetch our auto payouts, process them
|
// Fetch our auto payouts, process them
|
||||||
if ($setting->getValue('disable_auto_payouts') != 1 && $aAutoPayouts) {
|
if ($setting->getValue('disable_auto_payouts') != 1 && $aAutoPayouts) {
|
||||||
|
|||||||
@ -288,7 +288,7 @@ class Transaction extends Base {
|
|||||||
* @param none
|
* @param none
|
||||||
* @return data array Account settings and confirmed balances
|
* @return data array Account settings and confirmed balances
|
||||||
**/
|
**/
|
||||||
public function getAPQueue() {
|
public function getAPQueue($limit=250) {
|
||||||
$this->debug->append("STA " . __METHOD__, 4);
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
@ -312,8 +312,9 @@ class Transaction extends Base {
|
|||||||
ON t.account_id = a.id
|
ON t.account_id = a.id
|
||||||
WHERE t.archived = 0 AND a.ap_threshold > 0 AND a.coin_address IS NOT NULL AND a.coin_address != ''
|
WHERE t.archived = 0 AND a.ap_threshold > 0 AND a.coin_address IS NOT NULL AND a.coin_address != ''
|
||||||
GROUP BY t.account_id
|
GROUP BY t.account_id
|
||||||
HAVING confirmed > a.ap_threshold AND confirmed > " . $this->config['txfee_auto']);
|
HAVING confirmed > a.ap_threshold AND confirmed > " . $this->config['txfee_auto'] . "
|
||||||
if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result())
|
LIMIT ?");
|
||||||
|
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $limit) && $stmt->execute() && $result = $stmt->get_result())
|
||||||
return $result->fetch_all(MYSQLI_ASSOC);
|
return $result->fetch_all(MYSQLI_ASSOC);
|
||||||
return $this->sqlError();
|
return $this->sqlError();
|
||||||
}
|
}
|
||||||
@ -377,7 +378,7 @@ class Transaction extends Base {
|
|||||||
* @param none
|
* @param none
|
||||||
* @return data Associative array with DB Fields
|
* @return data Associative array with DB Fields
|
||||||
**/
|
**/
|
||||||
public function getMPQueue() {
|
public function getMPQueue($limit=250) {
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
a.id,
|
a.id,
|
||||||
@ -403,8 +404,9 @@ class Transaction extends Base {
|
|||||||
ON t.block_id = b.id
|
ON t.block_id = b.id
|
||||||
WHERE p.completed = 0 AND t.archived = 0 AND a.coin_address IS NOT NULL AND a.coin_address != ''
|
WHERE p.completed = 0 AND t.archived = 0 AND a.coin_address IS NOT NULL AND a.coin_address != ''
|
||||||
GROUP BY t.account_id
|
GROUP BY t.account_id
|
||||||
HAVING confirmed > " . $this->config['txfee_manual']);
|
HAVING confirmed > " . $this->config['txfee_manual'] . "
|
||||||
if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result())
|
LIMIT ?");
|
||||||
|
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $limit) && $stmt->execute() && $result = $stmt->get_result())
|
||||||
return $result->fetch_all(MYSQLI_ASSOC);
|
return $result->fetch_all(MYSQLI_ASSOC);
|
||||||
return $this->sqlError('E0050');
|
return $this->sqlError('E0050');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -142,6 +142,13 @@ $config['payout_system'] = 'prop';
|
|||||||
**/
|
**/
|
||||||
$config['sendmany']['enabled'] = false;
|
$config['sendmany']['enabled'] = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transaction Limits
|
||||||
|
* Number of transactions per payout run
|
||||||
|
**/
|
||||||
|
$config['payout']['txlimit_manual'] = 500;
|
||||||
|
$config['payout']['txlimit_auto'] = 500;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Round Purging
|
* Round Purging
|
||||||
* Round share purging configuration
|
* Round share purging configuration
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user