code: func (i *Inbox) autoCash(cashInterval time.Duration) {
  	if i.quit != nil {
  		close(i.quit)
  		i.quit = nil
  	}
  	// if maxUncashed is set to 0, then autocash on receipt
  	if cashInterval == time.Duration(0) || i.maxUncashed != nil && i.maxUncashed.Sign() == 0 {
  		return
  	}
  
  	ticker := time.NewTicker(cashInterval)
  	i.quit = make(chan bool)
  	quit := i.quit
  
  	go func() {
  		for {
  			select {
  			case <-quit:
  				return
  			case <-ticker.C:
  				i.lock.Lock()
  				if i.cheque != nil && i.cheque.Amount.Cmp(i.cashed) != 0 {
  					txhash, err := i.Cash()
  					if err == nil {
  						i.txhash = txhash
  					}
  				}
  				i.lock.Unlock()
  			}
  		}
  	}()
  }
docs: // autoCash starts a loop that periodically clears the last cheque
  // if the peer is trusted. Clearing period could be 24h or a week.
  // The caller must hold lock.