From 7229b5b130e6a48ca597cb28c692fe3510270c01 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 18 Feb 2014 09:16:26 +0100 Subject: [PATCH 1/2] [ADDED] Payout Queue Limiter * [ADDED] LIMIT to getMPQueue and getAPQueue * [ADDED] Default config payout queue size of 1000 for MP and 1000 for AP * [UPDATED] Payouts cronjob to use this new default limits This may help some coins that have tx count issues when doing sendmany. Other coins can play with the values to find their sweet spot. Run the payout multiple times in a row to force more transactions of the same amount. Fixes #1773 and thanks to @jrwr for the idea! --- cronjobs/payouts.php | 4 ++-- public/include/classes/transaction.class.php | 14 ++++++++------ public/include/config/global.inc.dist.php | 7 +++++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/cronjobs/payouts.php b/cronjobs/payouts.php index a21d9bd1..7ebc13a8 100755 --- a/cronjobs/payouts.php +++ b/cronjobs/payouts.php @@ -45,7 +45,7 @@ if (!$dWalletBalance = $bitcoin->getrealbalance()) $dWalletBalance = 0; // Fetch outstanding manual-payouts -$aManualPayouts = $transaction->getMPQueue(); +$aManualPayouts = $transaction->getMPQueue($config['payout']['txlimit_manual']); // Fetch our manual payouts, process them if ($setting->getValue('disable_manual_payouts') != 1 && $aManualPayouts) { @@ -117,7 +117,7 @@ if (!$dWalletBalance = $bitcoin->getrealbalance()) $dWalletBalance = 0; // Fetch outstanding auto-payouts -$aAutoPayouts = $transaction->getAPQueue(); +$aAutoPayouts = $transaction->getAPQueue($config['payout']['txlimit_auto']); // Fetch our auto payouts, process them if ($setting->getValue('disable_auto_payouts') != 1 && $aAutoPayouts) { diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index 3fe76a61..a7f48be2 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -288,7 +288,7 @@ class Transaction extends Base { * @param none * @return data array Account settings and confirmed balances **/ - public function getAPQueue() { + public function getAPQueue($limit=250) { $this->debug->append("STA " . __METHOD__, 4); $stmt = $this->mysqli->prepare(" SELECT @@ -312,8 +312,9 @@ class Transaction extends Base { 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 != '' GROUP BY t.account_id - HAVING confirmed > a.ap_threshold AND confirmed > " . $this->config['txfee_auto']); - if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result()) + HAVING confirmed > a.ap_threshold AND confirmed > " . $this->config['txfee_auto'] . " + LIMIT ?"); + if ($this->checkStmt($stmt) && $stmt->bind_param('i', $limit) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); return $this->sqlError(); } @@ -377,7 +378,7 @@ class Transaction extends Base { * @param none * @return data Associative array with DB Fields **/ - public function getMPQueue() { + public function getMPQueue($limit=250) { $stmt = $this->mysqli->prepare(" SELECT a.id, @@ -403,8 +404,9 @@ class Transaction extends Base { 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 != '' GROUP BY t.account_id - HAVING confirmed > " . $this->config['txfee_manual']); - if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result()) + HAVING confirmed > " . $this->config['txfee_manual'] . " + LIMIT ?"); + if ($this->checkStmt($stmt) && $stmt->bind_param('i', $limit) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); return $this->sqlError('E0050'); } diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index 900ca7de..a552581e 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -142,6 +142,13 @@ $config['payout_system'] = 'prop'; **/ $config['sendmany']['enabled'] = false; +/** + * Transaction Limits + * Number of transactions per payout run + **/ +$config['payout']['txlimit_manual'] = 1000; +$config['payout']['txlimit_auto'] = 1000; + /** * Round Purging * Round share purging configuration From a4e3468b9b12096998303513bfd0e19027c5ad2e Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 18 Feb 2014 09:22:16 +0100 Subject: [PATCH 2/2] [CHANGE] 500 default limit --- public/include/config/global.inc.dist.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index a552581e..4edc2ad2 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -146,8 +146,8 @@ $config['sendmany']['enabled'] = false; * Transaction Limits * Number of transactions per payout run **/ -$config['payout']['txlimit_manual'] = 1000; -$config['payout']['txlimit_auto'] = 1000; +$config['payout']['txlimit_manual'] = 500; +$config['payout']['txlimit_auto'] = 500; /** * Round Purging