code: func (msg *MsgAddr) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error {
  	// Protocol versions before MultipleAddressVersion only allowed 1 address
  	// per message.
  	count := len(msg.AddrList)
  	if pver < MultipleAddressVersion && count > 1 {
  		str := fmt.Sprintf("too many addresses for message of "+
  			"protocol version %v [count %v, max 1]", pver, count)
  		return messageError("MsgAddr.BtcEncode", str)
  
  	}
  	if count > MaxAddrPerMsg {
  		str := fmt.Sprintf("too many addresses for message "+
  			"[count %v, max %v]", count, MaxAddrPerMsg)
  		return messageError("MsgAddr.BtcEncode", str)
  	}
  
  	err := WriteVarInt(w, pver, uint64(count))
  	if err != nil {
  		return err
  	}
  
  	for _, na := range msg.AddrList {
  		err = writeNetAddress(w, pver, na, true)
  		if err != nil {
  			return err
  		}
  	}
  
  	return nil
  }
docs: // BtcEncode encodes the receiver to w using the bitcoin protocol encoding.
  // This is part of the Message interface implementation.