aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/credits.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 05:31:09 -0400
committerhistoria <[not public]>2026-09-18 05:31:09 -0400
commit153acb7f644d755c45533b7c5311e3ffa47e8973 (patch)
tree7645e6f7b65bc3830b078e3b9336d2e6b199d584 /internal/casino/credits.go
parent87d08f0151e643951769e323995f1c5ed89ee200 (diff)
downloadthehouseoficarus-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.go16
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