diff options
Diffstat (limited to 'internal/casino/types.go')
| -rw-r--r-- | internal/casino/types.go | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/internal/casino/types.go b/internal/casino/types.go index a5e1415..0400df4 100644 --- a/internal/casino/types.go +++ b/internal/casino/types.go @@ -191,9 +191,9 @@ type Wager struct { Total int Chips int Credits int - // ID is the wallet's opaque handle for the committed stake. Table - // settlements pass the hand's stake IDs to PayStakeCover so the wallet - // removes exactly the stakes the payout returns. + // ID is the wallet's opaque handle for the committed stake. It names the + // stake when a settlement resolves it (PayCredits) or consumes it + // (ResolveStake). ID string } @@ -202,20 +202,16 @@ type Wallet interface { // is a normal rejected bet; ErrWalletPersistence means the debit could // not be made durable and the game must not proceed as if it succeeded. Wager(amount int) (Wager, error) - // PayCredits pays winnings durably, returning an error when the credit - // could not be persisted (the game must not report a win that is not - // durable). The payout carries no stake linkage: the stake was consumed - // by playing the round, so the game resolves it separately. - 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). The credit and the removal of those stakes are one - // durable step, so a failed settlement leaves the stakes pending — - // refunded at the next startup, never paid on top of the refund. - PayStakeCover(amount int, stakeIDs []string) error + // PayCredits banks a payout durably and, in the same save, resolves the + // listed stakes (stakeIDs may be empty, for a payout that returns no + // stake). A table passes the hand's stake IDs so the payout and the + // stake return are one durable step; a slot win passes its triggering + // stake. A failed save leaves the stakes pending — refunded at the next + // startup, never paid on top of the refund — and the game must not + // announce the win. + PayCredits(amount int, stakeIDs ...string) error // ResolveStakes consumes every pending stake for this player: the round - // resolved as a loss, a forfeit, or an unlinked payout, so the stakes - // must not be refunded. + // resolved as a loss or a forfeit, so the stakes must not be refunded. ResolveStakes() // ResolveStake consumes ONE pending stake by wallet handle (a single // hand paid or lost while a sibling hand's round is still in flight). |
