211
212// PruneBlobsBundleCacheRoutine prunes the blobs bundle cache at 6s mark of the slot.
213func (vs *Server) PruneBlobsBundleCacheRoutine() {
214 go func() {215 clock, err := vs.ClockWaiter.WaitForClock(vs.Ctx)
216 if err != nil {
217 log.WithError(err).Error("PruneBlobsBundleCacheRoutine failed to receive genesis data")
81// Start listening for received indexed attestations and blocks
82// and perform slashing detection on them.
83func (s *Service) Start() {
84 go s.run() // Start functions must be non-blocking. 85}
86
87func (s *Service) run() {
65
66// This routine processes fork choice attestations from the pool to account for validator votes and fork choice.
67func (s *Service) spawnProcessAttestationsRoutine() {
68 go func() { 69 _, err := s.clockWaiter.WaitForClock(s.ctx)
70 if err != nil {
71 log.WithError(err).Error("spawnProcessAttestationsRoutine failed to receive genesis data")
Function invocations are expected to be synchronous, but this function will execute asynchronously because every instruction of the function is executed in a goroutine. Instead, it is recommended to remove the internal goroutine and call the function using 'go'.
func hello() {
go func() {
fmt.Println("hello world")
}()
}
func world() {
hello()
...
}
func hello() {
fmt.Println("hello world")
}
func world() {
go hello()
...
}