aboutsummaryrefslogtreecommitdiff
path: root/internal/game/game.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 21:36:36 -0400
committerhistoria <[not public]>2026-09-18 21:36:36 -0400
commita8a67482bbff8297a96adff65d2fd7029ed998cc (patch)
treee84f8ba636c8f2edb4d2ff8b45d7cff7298fa7cc /internal/game/game.go
parentff04d26ce90d6b411a04a2fb59f7c24ceefb161f (diff)
downloadthehouseoficarus-a8a67482bbff8297a96adff65d2fd7029ed998cc.tar.gz
refactor: replace economy journal with single-file pending-wager wallet
Diffstat (limited to 'internal/game/game.go')
-rw-r--r--internal/game/game.go24
1 files changed, 9 insertions, 15 deletions
diff --git a/internal/game/game.go b/internal/game/game.go
index c0c6488..5aad784 100644
--- a/internal/game/game.go
+++ b/internal/game/game.go
@@ -107,9 +107,6 @@ type Game struct {
shutdownSaveMu sync.Mutex
shutdownSaveErr error
- // Economy is the durable money journal; see economy.go.
- Economy *economyJournal
-
// loginThrottle applies an escalating per-(account, IP) delay to failed
// interactive password attempts. Lazily created so Game literals built
// directly in tests work without it.
@@ -166,19 +163,16 @@ func New(dataDir string, colorConfig *config.ColorsConfig, constantColorConfig *
// which statically references executeShutdown, cannot form an
// initialization cycle with the shutdown coordinator.
g.shutdownHook = g.RequestShutdown
- g.Economy = newEconomyJournal(dataDir)
- // Lifecycle-journal rollback MUST run before economy recovery: a rolled-
- // back rename transaction restores an older character before-image, and
- // if money compensation ran first its settled/compacted records would no
- // longer be recoverable — the rollback would silently erase a payout
- // that was already re-applied. Rollback also precedes every store read
- // below (courses, mods, techs, craft index) that a leftover transaction
- // may reference. See the TestEconomyRecoveryRunsAfterLifecycleRollback
- // regression.
+ // Lifecycle-journal rollback MUST run before pending-wager recovery: a
+ // rolled-back rename transaction restores an older character
+ // before-image, and a refund applied to the post-rename file would be
+ // lost when the rollback replaced it with the before-image. Rollback
+ // also precedes every store read below (courses, mods, techs, craft
+ // index) that a leftover transaction may reference.
g.recoverJournals()
- // Compensate open money records from any prior crash before any
- // session can connect.
- g.recoverEconomy()
+ // Refund any stake left in flight by an ungraceful stop before any
+ // session can connect. The character file is the only money record.
+ g.recoverPendingWagers()
g.CourseStore.SetWorld(g.World)
g.CourseStore.LoadAll()
g.LoadMods()