code: func (s *server) rebroadcastHandler() {
  	// Wait 5 min before first tx rebroadcast.
  	timer := time.NewTimer(5 * time.Minute)
  	pendingInvs := make(map[wire.InvVect]interface{})
  
  out:
  	for {
  		select {
  		case riv := <-s.modifyRebroadcastInv:
  			switch msg := riv.(type) {
  			// Incoming InvVects are added to our map of RPC txs.
  			case broadcastInventoryAdd:
  				pendingInvs[*msg.invVect] = msg.data
  
  			// When an InvVect has been added to a block, we can
  			// now remove it, if it was present.
  			case broadcastInventoryDel:
  				if _, ok := pendingInvs[*msg]; ok {
  					delete(pendingInvs, *msg)
  				}
  			}
  
  		case <-timer.C:
  			// Any inventory we have has not made it into a block
  			// yet. We periodically resubmit them until they have.
  			for iv, data := range pendingInvs {
  				ivCopy := iv
  				s.RelayInventory(&ivCopy, data)
  			}
  
  			// Process at a random time up to 30mins (in seconds)
  			// in the future.
  			timer.Reset(time.Second *
  				time.Duration(randomUint16Number(1800)))
  
  		case <-s.quit:
  			break out
  		}
  	}
  
  	timer.Stop()
  
  	// Drain channels before exiting so nothing is left waiting around
  	// to send.
  cleanup:
  	for {
  		select {
  		case <-s.modifyRebroadcastInv:
  		default:
  			break cleanup
  		}
  	}
  	s.wg.Done()
  }
docs: // rebroadcastHandler keeps track of user submitted inventories that we have
  // sent out but have not yet made it into a block. We periodically rebroadcast
  // them in case our peers restarted or otherwise lost track of them.