Skip to content

Commit

Permalink
feat(availability): env var to disable pruning
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Nov 18, 2024
1 parent b24d47f commit 816b9e5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion share/availability/window.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package availability

import "time"
import (
"os"
"time"
)

const (
RequestWindow = 30 * 24 * time.Hour
Expand All @@ -11,8 +14,14 @@ const (
// given AvailabilityWindow. If the window is disabled (0), it returns true for
// every timestamp.
func IsWithinWindow(t time.Time, window time.Duration) bool {
if alwaysAvailable {
return true
}
if window == time.Duration(0) {
return true
}
return time.Since(t) <= window
}

// alwaysAvailable is a flag that disables the availability window.
var alwaysAvailable = os.Getenv("CELESTIA_PRUNING_DISABLED") == "true"

0 comments on commit 816b9e5

Please sign in to comment.