feat(store): add new api LatestVersion (#22305)
This commit is contained in:
@@ -36,6 +36,10 @@ func (cdsa commitDBStoreAdapter) LastCommitID() types.CommitID {
|
||||
}
|
||||
}
|
||||
|
||||
func (cdsa commitDBStoreAdapter) LatestVersion() int64 {
|
||||
return -1
|
||||
}
|
||||
|
||||
func (cdsa commitDBStoreAdapter) WorkingHash() []byte {
|
||||
return commithash
|
||||
}
|
||||
|
||||
@@ -434,7 +434,11 @@ func (rs *Store) PopStateCache() []*types.StoreKVPair {
|
||||
|
||||
// LatestVersion returns the latest version in the store
|
||||
func (rs *Store) LatestVersion() int64 {
|
||||
return rs.LastCommitID().Version
|
||||
if rs.lastCommitInfo == nil {
|
||||
return GetLatestVersion(rs.db)
|
||||
}
|
||||
|
||||
return rs.lastCommitInfo.Version
|
||||
}
|
||||
|
||||
// LastCommitID implements Committer/CommitStore.
|
||||
|
||||
Reference in New Issue
Block a user