Skip to content

Commit

Permalink
get latest version directly from the db in Snapshot() to avoid data race
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Mar 22, 2022
1 parent 56b4781 commit bdb1112
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion store/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit bdb1112

Please sign in to comment.