diff --git a/.gitignore b/.gitignore index beb476a1b631..2093d4e7e97e 100644 --- a/.gitignore +++ b/.gitignore @@ -24,11 +24,7 @@ dist tools-stamp buf-stamp artifacts -simapp/simd/simd - -# Go -go.work -go.work.sum +tools/ # Data - ideally these don't exist baseapp/data/* diff --git a/client/snapshot/dump.go b/client/snapshot/dump.go index 917dca071512..72dadbc57254 100644 --- a/client/snapshot/dump.go +++ b/client/snapshot/dump.go @@ -3,6 +3,7 @@ package snapshot import ( "archive/tar" "compress/gzip" + "errors" "fmt" "io" "os" @@ -48,6 +49,10 @@ func DumpArchiveCmd() *cobra.Command { return err } + if snapshot == nil { + return errors.New("snapshot doesn't exist") + } + bz, err := snapshot.Marshal() if err != nil { return err diff --git a/store/snapshots/manager.go b/store/snapshots/manager.go index cc704742f912..717a74ae73fc 100644 --- a/store/snapshots/manager.go +++ b/store/snapshots/manager.go @@ -492,6 +492,10 @@ func (m *Manager) RestoreLocalSnapshot(height uint64, format uint32) error { return err } + if snapshot == nil { + return fmt.Errorf("snapshot doesn't exist, height: %d, format: %d", height, format) + } + m.mtx.Lock() defer m.mtx.Unlock()