Skip to content

Commit

Permalink
Merge pull request #72 from sei-protocol/yiren/SEI-7956
Browse files Browse the repository at this point in the history
fix: init app earliest version correctly after state sync
  • Loading branch information
blindchaser authored Aug 19, 2024
2 parents cc7801b + d43eb77 commit 22fde3c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ss/pebbledb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,14 @@ func (db *Database) GetLatestVersion() (int64, error) {
}

func (db *Database) SetEarliestVersion(version int64) error {
db.earliestVersion = version
if version > db.earliestVersion {
db.earliestVersion = version

var ts [VersionSize]byte
binary.LittleEndian.PutUint64(ts[:], uint64(version))
return db.storage.Set([]byte(earliestVersionKey), ts[:], defaultWriteOpts)
var ts [VersionSize]byte
binary.LittleEndian.PutUint64(ts[:], uint64(version))
return db.storage.Set([]byte(earliestVersionKey), ts[:], defaultWriteOpts)
}
return nil
}

func (db *Database) GetEarliestVersion() (int64, error) {
Expand Down

0 comments on commit 22fde3c

Please sign in to comment.