From 9e25c410a62afd4a30e7c1edfb182c2c0f6382c6 Mon Sep 17 00:00:00 2001 From: catShaark Date: Wed, 25 May 2022 07:14:44 +0700 Subject: [PATCH 1/2] use empty map instead of nil for setting snapshotManager.extensions --- baseapp/options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baseapp/options.go b/baseapp/options.go index 721fb612ffd8..a97d8decbfb0 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -218,7 +218,7 @@ func (app *BaseApp) SetSnapshot(snapshotStore *snapshots.Store, opts snapshottyp return } app.cms.SetSnapshotInterval(opts.Interval) - app.snapshotManager = snapshots.NewManager(snapshotStore, opts, app.cms, nil, app.logger) + app.snapshotManager = snapshots.NewManager(snapshotStore, opts, app.cms, map[string]snapshottypes.ExtensionSnapshotter{}, app.logger) } // SetInterfaceRegistry sets the InterfaceRegistry. From b027cf0580752a1e479d44c778329feae6bfccb2 Mon Sep 17 00:00:00 2001 From: catShaark Date: Thu, 26 May 2022 00:19:05 +0700 Subject: [PATCH 2/2] change snapshots.NewManager() --- baseapp/options.go | 2 +- snapshots/manager.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/baseapp/options.go b/baseapp/options.go index 2b789569f8b3..57abd2b19960 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -218,7 +218,7 @@ func (app *BaseApp) SetSnapshot(snapshotStore *snapshots.Store, opts snapshottyp return } app.cms.SetSnapshotInterval(opts.Interval) - app.snapshotManager = snapshots.NewManager(snapshotStore, opts, app.cms, map[string]snapshottypes.ExtensionSnapshotter{}, app.logger) + app.snapshotManager = snapshots.NewManager(snapshotStore, opts, app.cms, nil, app.logger) } // SetInterfaceRegistry sets the InterfaceRegistry. diff --git a/snapshots/manager.go b/snapshots/manager.go index 8d10dcc9c713..dbca39ea2be7 100644 --- a/snapshots/manager.go +++ b/snapshots/manager.go @@ -70,6 +70,9 @@ var ErrOptsZeroSnapshotInterval = errors.New("snaphot-interval must not be 0") // NewManager creates a new manager. func NewManager(store *Store, opts types.SnapshotOptions, multistore types.Snapshotter, extensions map[string]types.ExtensionSnapshotter, logger log.Logger) *Manager { + if extensions == nil { + extensions = map[string]types.ExtensionSnapshotter{} + } return &Manager{ store: store, opts: opts,