mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 02:31:19 +00:00
28 lines
721 B
Go
28 lines
721 B
Go
|
package policies
|
||
|
|
||
|
// AfterNthEpoch runs for every epoch after the provided epoch.
|
||
|
func AfterNthEpoch(afterEpoch uint64) func(uint64) bool {
|
||
|
return func(currentEpoch uint64) bool {
|
||
|
return currentEpoch > afterEpoch
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// AllEpochs runs for all epochs.
|
||
|
func AllEpochs(_ uint64) bool {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
// OnEpoch runs only for the provided epoch.
|
||
|
func OnEpoch(epoch uint64) func(uint64) bool {
|
||
|
return func(currentEpoch uint64) bool {
|
||
|
return currentEpoch == epoch
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// BetweenEpochs runs for every epoch that is between the provided epochs.
|
||
|
func BetweenEpochs(fromEpoch, toEpoch uint64) func(uint64) bool {
|
||
|
return func(currentEpoch uint64) bool {
|
||
|
return fromEpoch < currentEpoch && currentEpoch < toEpoch
|
||
|
}
|
||
|
}
|