From bdb11129422ea3f2c19f8571862fbbf34b0faef8 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 21 Mar 2022 20:56:13 -0700 Subject: [PATCH] get latest version directly from the db in Snapshot() to avoid data race --- store/rootmulti/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index 4bb481a85fa7..a8e5815d2d7e 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -664,7 +664,7 @@ func (rs *Store) Snapshot(height uint64, format uint32) (<-chan io.ReadCloser, e if height == 0 { return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "cannot snapshot height 0") } - if height > uint64(rs.LastCommitID().Version) { + if height > uint64(getLatestVersion(rs.db)) { return nil, sdkerrors.Wrapf(sdkerrors.ErrLogic, "cannot snapshot future height %v", height) }