aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/types.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/types.go')
-rw-r--r--internal/casino/types.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/internal/casino/types.go b/internal/casino/types.go
index d000375..283aa43 100644
--- a/internal/casino/types.go
+++ b/internal/casino/types.go
@@ -160,6 +160,10 @@ type Wager struct {
Total int
Chips int
Credits int
+ // ID is the wallet's opaque handle for the journaled stake record:
+ // table settlements pay through PayStakeCover with the hand's stake
+ // IDs so the journal can prove which wager a settlement returns.
+ ID string
}
type Wallet interface {
@@ -169,13 +173,26 @@ type Wallet interface {
Wager(amount int) (Wager, error)
// PayCredits pays a settlement durably, returning an error when the
// credit could not be persisted (the game must not report a win that
- // is not durable).
+ // is not durable). The journaled record carries no stake linkage:
+ // recovery treats it as resolving the round (a slots payout is
+ // winnings only; the stake was consumed by playing the round).
PayCredits(amount int) error
+ // PayStakeCover pays a settlement whose amount INCLUDES the return of
+ // the listed stake wager IDs (a table hand pays back its stake inside
+ // the payout). When the payout cannot be made durable, the open
+ // journal record still proves those stakes were returned inside it, so
+ // a shutdown refund must not return them a second time and recovery
+ // re-applies the owed payout instead.
+ PayStakeCover(amount int, stakeIDs []string) error
// ResolveStakes marks every outstanding stake for this player as
// settled: the round resolved (won, lost, pushed, or forfeited), so
// startup recovery must no longer refund it. A stake whose wager
// record remains open at restart is refunded by recovery.
ResolveStakes()
+ // ResolveStake settles ONE outstanding stake by wallet handle (a
+ // single hand paid or lost while a sibling hand's payout is still in
+ // flight): its return is proven, so it must never be refunded.
+ ResolveStake(stakeID string)
// RefundOutstanding returns every outstanding stake to the player
// (chips as chips, credits through the durable payout path) and
// resolves the stakes. It reports the amounts returned. An error