From 9666676766bf21364f4fc4d0d1d336e72f2a91b4 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 6 Oct 2026 12:57:23 -0400 Subject: refactor: split casino.go, dedup helpers, remove audit docs --- internal/casino/types.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'internal/casino/types.go') diff --git a/internal/casino/types.go b/internal/casino/types.go index f6a828d..9a3f0a1 100644 --- a/internal/casino/types.go +++ b/internal/casino/types.go @@ -237,6 +237,11 @@ type Wallet interface { // refund could not be made durable: nothing was returned and the stakes // remain pending for a later attempt or startup recovery. RefundOutstanding() (chips, credits int, err error) + // RefundStakes returns the named pending stakes in kind — chips as chips, + // credits as credits — and removes them from the ledger in one save. It is + // the take-back path for a seat that holds specific handles; unlike + // PayCredits it never converts casino-only chips into spendable credits. + RefundStakes(stakeIDs ...string) error } type EventType string @@ -381,3 +386,11 @@ type Participant struct { SitOutAfter bool LeaveAfter bool } + +// SettlementBalanceNeeded reports whether a settlement should print the seat's +// balance: the seat is leaving, sitting out after the round, or disconnected, +// and the payout did not fail. Shared by every table so the rule lives in one +// place instead of being copy-pasted per game. +func (p *Participant) SettlementBalanceNeeded(payoutFailed bool) bool { + return !payoutFailed && (p.LeaveAfter || p.SitOutAfter || !p.Connected) +} -- cgit v1.2.3