diff options
| author | historia <[not public]> | 2026-09-17 22:00:33 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-17 22:00:33 -0400 |
| commit | 32a3c59cebf2a16277e54d715a67adfdbe00b456 (patch) | |
| tree | 9bc87011513ef92f0613d9339fc55689f130915d /internal/casino/types.go | |
| parent | fea2cc6839ec3ee17940a2dea69622dc6f4deabf (diff) | |
| download | thehouseoficarus-32a3c59cebf2a16277e54d715a67adfdbe00b456.tar.gz | |
fix: exact casino settlement/refund coverage, journal damage handling, craft output ordering, aggregate ingredient planning
Diffstat (limited to 'internal/casino/types.go')
| -rw-r--r-- | internal/casino/types.go | 19 |
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 |
