From d4e2a5283f5c596c153318f6275bde59ac422922 Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 24 Aug 2026 18:16:28 +0200 Subject: Fix balance: only credit winnings, not refund the bet on every spin --- src/bin/server/handler.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bin/server') diff --git a/src/bin/server/handler.rs b/src/bin/server/handler.rs index 5406e85..0a4934f 100644 --- a/src/bin/server/handler.rs +++ b/src/bin/server/handler.rs @@ -185,7 +185,7 @@ fn handle_play_start(user: &str, game_type: &str, bet_amount_str: &str) -> Strin let session_id = SESSIONS.create_session(user, game_type.to_string(), new_state.clone()); // All balance mutations in a single transaction. - let total_return = bet_amount + result.winnings as i64; + let total_return = result.winnings as i64; let tx_result = db.execute_batch(&format!( "UPDATE users SET balance = balance - {bet_amount} WHERE username = '{user}'; UPDATE users SET balance = balance + {total_return} WHERE username = '{user}';" -- cgit v1.2.3