diff options
| author | historia <[not public]> | 2026-09-18 05:31:09 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 05:31:09 -0400 |
| commit | 153acb7f644d755c45533b7c5311e3ffa47e8973 (patch) | |
| tree | 7645e6f7b65bc3830b078e3b9336d2e6b199d584 /internal/casino/credits.go | |
| parent | 87d08f0151e643951769e323995f1c5ed89ee200 (diff) | |
| download | thehouseoficarus-153acb7f644d755c45533b7c5311e3ffa47e8973.tar.gz | |
fix: harden engine across casino, economy, concurrency, security, and content
Diffstat (limited to 'internal/casino/credits.go')
| -rw-r--r-- | internal/casino/credits.go | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/internal/casino/credits.go b/internal/casino/credits.go index 2b4e2d7..8b7cb7a 100644 --- a/internal/casino/credits.go +++ b/internal/casino/credits.go @@ -30,22 +30,6 @@ var ( ErrWalletPersistence = errors.New("wallet persistence failure") ) -// AddCredits adds two balances with an explicit cap, reporting overflow. -// A negative addend is rejected (payouts never decrease a balance). -func AddCredits(a, b int) (int, error) { - if b < 0 { - return a, errors.New("negative credit add") - } - sum := a + b - if b > 0 && sum < a || a > 0 && sum < b { - return MaxCredits, fmt.Errorf("credit overflow: %d + %d exceeds %d", a, b, MaxCredits) - } - if sum > MaxCredits { - return MaxCredits, fmt.Errorf("credit overflow: %d + %d exceeds %d", a, b, MaxCredits) - } - return sum, nil -} - // MulPayout scales an amount by a payout multiplier and converts to whole // credits (floor, like a house paying in chips). Overflow past MaxCredits // is an error, not a silent wrap. A non-finite or negative multiplier is |
