code: func (f *lightFetcher) checkUpdateStats(p *peer, newEntry *updateStatsEntry) {
  	now := mclock.Now()
  	fp := f.peers[p]
  	if fp == nil {
  		p.Log().Debug("Unknown peer to check update stats")
  		return
  	}
  
  	if newEntry != nil && fp.firstUpdateStats == nil {
  		fp.firstUpdateStats = newEntry
  	}
  	for fp.firstUpdateStats != nil && fp.firstUpdateStats.time <= now-mclock.AbsTime(blockDelayTimeout) {
  		f.pm.serverPool.adjustBlockDelay(p.poolEntry, blockDelayTimeout)
  		fp.firstUpdateStats = fp.firstUpdateStats.next
  	}
  	if fp.confirmedTd != nil {
  		for fp.firstUpdateStats != nil && fp.firstUpdateStats.td.Cmp(fp.confirmedTd) <= 0 {
  			f.pm.serverPool.adjustBlockDelay(p.poolEntry, time.Duration(now-fp.firstUpdateStats.time))
  			fp.firstUpdateStats = fp.firstUpdateStats.next
  		}
  	}
  }
docs: // checkUpdateStats checks those peers who have not confirmed a certain highest Td (or a larger one) by the time it
  // has been confirmed by another peer. If they have confirmed such a head by now, their stats are updated with the
  // block delay which is (this peer's confirmation time)-(first confirmation time). After blockDelayTimeout has passed,
  // the stats are updated with blockDelayTimeout value. In either case, the confirmed or timed out updateStatsEntry
  // items are removed from the head of the linked list.
  // If a new entry has been added to the global tail, it is passed as a parameter here even though this function
  // assumes that it has already been added, so that if the peer's list is empty (all heads confirmed, head is nil),
  // it can set the new head to newEntry.