diff --git a/internal/blocksync/pool.go b/internal/blocksync/pool.go index 4c905c660..7f133a7a1 100644 --- a/internal/blocksync/pool.go +++ b/internal/blocksync/pool.go @@ -86,7 +86,6 @@ type BlockPool struct { requestsCh chan<- BlockRequest errorsCh chan<- peerError - exitedCh chan struct{} startHeight int64 lastHundredBlockTimeStamp time.Time @@ -109,7 +108,6 @@ func NewBlockPool( height: start, startHeight: start, numPending: 0, - exitedCh: make(chan struct{}), requestsCh: requestsCh, errorsCh: errorsCh, lastSyncRate: 0, @@ -125,11 +123,6 @@ func (pool *BlockPool) OnStart(ctx context.Context) error { pool.lastHundredBlockTimeStamp = pool.lastAdvance go pool.makeRequestersRoutine(ctx) - go func() { - defer close(pool.exitedCh) - pool.Wait() - }() - return nil } @@ -637,12 +630,6 @@ func (bpr *bpRequester) redo(peerID types.NodeID) { // Responsible for making more requests as necessary // Returns only when a block is found (e.g. AddBlock() is called) func (bpr *bpRequester) requestRoutine(ctx context.Context) { - bprPoolDone := make(chan struct{}) - go func() { - defer close(bprPoolDone) - bpr.pool.Wait() - }() - OUTER_LOOP: for { // Pick a peer to send request to. @@ -670,9 +657,6 @@ OUTER_LOOP: select { case <-ctx.Done(): return - case <-bpr.pool.exitedCh: - bpr.Stop() - return case peerID := <-bpr.redoCh: if peerID == bpr.peerID { bpr.reset() diff --git a/internal/blocksync/reactor.go b/internal/blocksync/reactor.go index ea6f4a14d..b9c4e498c 100644 --- a/internal/blocksync/reactor.go +++ b/internal/blocksync/reactor.go @@ -427,8 +427,6 @@ func (r *Reactor) poolRoutine(ctx context.Context, stateSynced bool) { select { case <-ctx.Done(): return - case <-r.pool.exitedCh: - return case <-switchToConsensusTicker.C: var ( height, numPending, lenRequesters = r.pool.GetStatus()