Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions sei-db/state_db/sc/memiavl/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,10 +717,11 @@ func (db *DB) rewriteIfApplicable(height int64) {
snapshotVersion := db.SnapshotVersion()
blocksSinceLastSnapshot := height - snapshotVersion

// Create snapshot when both conditions are met:
// Create snapshot when all conditions are met:
// 1. Block height interval is reached (height - last snapshot >= interval)
// 2. Minimum time interval has elapsed (prevents excessive snapshots during catch-up)
if blocksSinceLastSnapshot >= int64(db.snapshotInterval) {
// 3. Block height % snapshot interval == 0
if blocksSinceLastSnapshot >= int64(db.snapshotInterval) && height%int64(db.snapshotInterval) == 0 {
timeSinceLastSnapshot := time.Since(db.lastSnapshotTime)

if timeSinceLastSnapshot < db.snapshotMinTimeInterval {
Expand Down
Loading