Skip to content

Commit 22fde3c

Browse files
authored
Merge pull request #72 from sei-protocol/yiren/SEI-7956
fix: init app earliest version correctly after state sync
2 parents cc7801b + d43eb77 commit 22fde3c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ss/pebbledb/db.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,14 @@ func (db *Database) GetLatestVersion() (int64, error) {
177177
}
178178

179179
func (db *Database) SetEarliestVersion(version int64) error {
180-
db.earliestVersion = version
180+
if version > db.earliestVersion {
181+
db.earliestVersion = version
181182

182-
var ts [VersionSize]byte
183-
binary.LittleEndian.PutUint64(ts[:], uint64(version))
184-
return db.storage.Set([]byte(earliestVersionKey), ts[:], defaultWriteOpts)
183+
var ts [VersionSize]byte
184+
binary.LittleEndian.PutUint64(ts[:], uint64(version))
185+
return db.storage.Set([]byte(earliestVersionKey), ts[:], defaultWriteOpts)
186+
}
187+
return nil
185188
}
186189

187190
func (db *Database) GetEarliestVersion() (int64, error) {

0 commit comments

Comments
 (0)