github.com/prysmaticlabs/prysm@v1.4.4/endtoend/policies/policies.go (about) 1 package policies 2 3 import types "github.com/prysmaticlabs/eth2-types" 4 5 // AfterNthEpoch runs for every epoch after the provided epoch. 6 func AfterNthEpoch(afterEpoch types.Epoch) func(epoch types.Epoch) bool { 7 return func(currentEpoch types.Epoch) bool { 8 return currentEpoch > afterEpoch 9 } 10 } 11 12 // AllEpochs runs for all epochs. 13 func AllEpochs(_ types.Epoch) bool { 14 return true 15 } 16 17 // OnEpoch runs only for the provided epoch. 18 func OnEpoch(epoch types.Epoch) func(types.Epoch) bool { 19 return func(currentEpoch types.Epoch) bool { 20 return currentEpoch == epoch 21 } 22 } 23 24 // BetweenEpochs runs for every epoch that is between the provided epochs. 25 func BetweenEpochs(fromEpoch, toEpoch types.Epoch) func(types.Epoch) bool { 26 return func(currentEpoch types.Epoch) bool { 27 return fromEpoch < currentEpoch && currentEpoch < toEpoch 28 } 29 }