code: func (s *DeviceSession) AppendUplinkHistory(up UplinkHistory) {
  	if count := len(s.UplinkHistory); count > 0 {
  		// ignore re-transmissions we don't know the source of the
  		// re-transmission (it might be a replay-attack)
  		if s.UplinkHistory[count-1].FCnt == up.FCnt {
  			return
  		}
  	}
  
  	s.UplinkHistory = append(s.UplinkHistory, up)
  	if count := len(s.UplinkHistory); count > UplinkHistorySize {
  		s.UplinkHistory = s.UplinkHistory[count-UplinkHistorySize : count]
  	}
  }
docs: // AppendUplinkHistory appends an UplinkHistory item and makes sure the list
  // never exceeds 20 records. In case more records are present, only the most
  // recent ones will be preserved. In case of a re-transmission, the record with
  // the best MaxSNR is stored.