code: func (b *Broadcaster) broadcastHandler(sub *blockntfns.Subscription) {
  	defer b.wg.Done()
  	defer sub.Cancel()
  
  	log.Infof("Broadcaster now active")
  
  	reBroadcastTicker := time.NewTicker(b.cfg.RebroadcastInterval)
  	defer reBroadcastTicker.Stop()
  
  	for {
  		select {
  		// A new broadcast request was submitted by an external caller.
  		case req := <-b.broadcastReqs:
  			req.errChan <- b.handleBroadcastReq(req)
  
  		// A new block notification has arrived, so we'll rebroadcast
  		// all of our pending transactions.
  		case block, ok := <-sub.Notifications:
  			if !ok {
  				log.Warn("Unable to rebroadcast transactions: " +
  					"block subscription was canceled")
  				continue
  			}
  
  			blockHeader := block.Header()
  
  			if len(b.transactions) != 0 {
  				log.Debugf("Re-broadcasting transaction at "+
  					"height=%v, hash=%v", block.Height(),
  					blockHeader.BlockHash())
  			}
  
  			b.rebroadcast()
  
  		// Between blocks, we'll also try to attempt additional
  		// re-broadcasts to ensure a timely confirmation.
  		case <-reBroadcastTicker.C:
  			if len(b.transactions) == 0 {
  				continue
  			}
  
  			b.rebroadcast()
  
  		case <-b.quit:
  			return
  		}
  	}
  }
docs: // broadcastHandler is the main event handler of the Broadcaster responsible for
  // handling new broadcast requests, rebroadcasting transactions upon every new
  // block, etc.
  //
  // NOTE: This must be run as a goroutine.