From 153acb7f644d755c45533b7c5311e3ffa47e8973 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 18 Sep 2026 05:31:09 -0400 Subject: fix: harden engine across casino, economy, concurrency, security, and content --- internal/casino/credits.go | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'internal/casino/credits.go') 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 -- cgit v1.2.3