properly register the snapshot manager

This commit is contained in:
Ethan Frey
2022-04-27 19:15:25 +02:00
parent abfadced9d
commit f789aed907

View File

@@ -667,6 +667,19 @@ func NewWasmApp(
app.SetBeginBlocker(app.BeginBlocker)
app.SetEndBlocker(app.EndBlocker)
// must be before Loading version
// requires the snapshot store to be created and registered as a BaseAppOption
// see cmd/wasmd/root.go: 206 - 214 approx
if manager := app.SnapshotManager(); manager != nil {
manager.RegisterExtensions(
wasm.NewWasmSnapshotter(app.CommitMultiStore(), app.wasmKeeper),
)
}
app.scopedIBCKeeper = scopedIBCKeeper
app.scopedTransferKeeper = scopedTransferKeeper
app.scopedWasmKeeper = scopedWasmKeeper
if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
tmos.Exit(fmt.Sprintf("failed to load latest version: %s", err))
@@ -679,14 +692,6 @@ func NewWasmApp(
}
}
app.scopedIBCKeeper = scopedIBCKeeper
app.scopedTransferKeeper = scopedTransferKeeper
app.scopedWasmKeeper = scopedWasmKeeper
app.SnapshotManager().RegisterExtensions(
wasm.NewWasmSnapshotter(app.CommitMultiStore(), app.wasmKeeper),
)
return app
}