minor refactor to anonymize interface.

This commit is contained in:
Raúl Kripalani 2021-05-14 20:08:15 +01:00
parent 28efa9357c
commit 9912212949

View File

@ -84,21 +84,24 @@ func NewWindowedPoStScheduler(api fullNodeFilteredAPI,
}, nil }, nil
} }
type changeHandlerAPIImpl struct { func (s *WindowPoStScheduler) Run(ctx context.Context) {
// Initialize change handler.
// callbacks is a union of the fullNodeFilteredAPI and ourselves.
callbacks := struct {
fullNodeFilteredAPI fullNodeFilteredAPI
*WindowPoStScheduler *WindowPoStScheduler
} }{s.api, s}
func (s *WindowPoStScheduler) Run(ctx context.Context) { s.ch = newChangeHandler(callbacks, s.actor)
// Initialize change handler
chImpl := &changeHandlerAPIImpl{fullNodeFilteredAPI: s.api, WindowPoStScheduler: s}
s.ch = newChangeHandler(chImpl, s.actor)
defer s.ch.shutdown() defer s.ch.shutdown()
s.ch.start() s.ch.start()
var notifs <-chan []*api.HeadChange var (
var err error notifs <-chan []*api.HeadChange
var gotCur bool err error
gotCur bool
)
// not fine to panic after this point // not fine to panic after this point
for { for {