-
Your Name authored
Commit match.result, under_over_result, and winning_outcomes atomically to the DB before sending PLAY_VIDEO_MATCH. A crash after this commit always recovers the same outcome on restart; before this fix, killing the process between extract_match() and the bet-settlement commit re-rolled the random draw on each restart, allowing an attacker to loop until a desired outcome was selected. Also adds an idempotency guard at the top of _handle_match_start: if the result is already committed (crash between lock and settlement), bets are re-settled from the stored result without re-extraction. Replaces the random fallback in _handle_play_video_match_done with a DB lookup of match.result, which is now always committed before the video player is signalled. Co-Authored-By:Claude Sonnet 4.6 <noreply@anthropic.com>
28ab7f76