Limit token unsweep fanout

This commit is contained in:
root
2026-05-30 17:52:10 +00:00
parent 4c8bcca936
commit 0e7a4d4e9c
3 changed files with 9 additions and 0 deletions
+1
View File
@@ -34,6 +34,7 @@ A PHP-based Telegram tip bot for the Salvium (Monero fork) cryptocurrency.
- `WITHDRAWAL_FEE` is charged in `SAL1` for `SAL1` withdrawals.
- `TOKEN_WITHDRAWALS_CHARGE_SAL1_FEE=false` lets token withdrawals use wallet-paid `SAL1` network fees.
- Set `TOKEN_WITHDRAWALS_CHARGE_SAL1_FEE=true` to require and reserve `WITHDRAWAL_FEE` `SAL1` from the user when withdrawing token assets.
- `MAX_TOKEN_UNSWEEP_OUTPUTS` limits token unsweep fan-out per run because token self-transfers also need SAL1 fee transactions.
## License
MIT
+1
View File
@@ -21,6 +21,7 @@ return [
'WITHDRAWAL_FEE' => 0.1,
'TOKEN_WITHDRAWALS_CHARGE_SAL1_FEE' => false,
'MAX_UNSWEEP_OUTPUTS' => 100,
'MAX_TOKEN_UNSWEEP_OUTPUTS' => 2,
'UNSWEEP_SAL1_FEE_RESERVE' => 0.5,
'UNSWEEP_TOKEN_SAL1_FEE_RESERVE' => 0.05,
'MAX_MULTI_TIPS' => 5
+7
View File
@@ -276,6 +276,13 @@ class SalviumTipBotCommands {
return "Too many outputs. Max is {$maxOutputs}.";
}
if ($assetType !== 'SAL1') {
$maxTokenOutputs = max(2, (int)($this->config['MAX_TOKEN_UNSWEEP_OUTPUTS'] ?? 2));
if ($outputCount > $maxTokenOutputs) {
return "Token unsweep can safely create up to {$maxTokenOutputs} outputs per run. Repeat after unlock to split further.";
}
}
$balanceData = $this->findAssetBalance($this->wallet->getBalance(0, [], $assetType), $assetType, null);
if (!$balanceData) {
return "Wallet has no {$assetType} balance.";