From 10ea987dfea7b1f03546c9a4a88888e40f9abbdc Mon Sep 17 00:00:00 2001
From: Ramaguru Radhakrishnan <r_ramaguru@cb.amrita.edu>
Date: Sat, 12 Feb 2022 16:53:04 +0530
Subject: [PATCH] Removed Commented Code

---
 .../com/rubix/WAMPAC/DID/DIDFunctions.java    | 87 +------------------
 1 file changed, 3 insertions(+), 84 deletions(-)

diff --git a/src/main/java/com/rubix/WAMPAC/DID/DIDFunctions.java b/src/main/java/com/rubix/WAMPAC/DID/DIDFunctions.java
index 2dd0029..471a67f 100644
--- a/src/main/java/com/rubix/WAMPAC/DID/DIDFunctions.java
+++ b/src/main/java/com/rubix/WAMPAC/DID/DIDFunctions.java
@@ -25,13 +25,9 @@ public class DIDFunctions {
     public static Logger DIDFunctionsLogger = Logger.getLogger(DIDFunctions.class);
     public static boolean checkIPStatus() throws JSONException, UnknownHostException {
 
-        String vipFile = readFile( "vip.json");
+        String vipFile = readFile("vip.json");
         JSONArray vipArray = new JSONArray(vipFile);
 
-//        InetAddress myIP = InetAddress.getLocalHost();
-//        String ip = myIP.getHostAddress();
-//        System.out.println("IP Check" + ip);
-
         String ip = ipClass.getIP();
         System.out.println("/checkIpStatus IP Address: " + ip);
 
@@ -46,28 +42,6 @@ public class DIDFunctions {
         }
         return false;
     }
-//    public static boolean syncVip(String role) throws IOException, JSONException {
-//        PropertyConfigurator.configure(LOGGER_PATH + "log4jWallet.properties");
-//        Functions.pathSet();
-//        boolean syncFlag = false;
-//        StringBuilder result = new StringBuilder();
-//        URL url = new URL(SYNC_IP + "/getvip");
-//        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-//        conn.setRequestMethod("GET");
-//        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
-//        String line;
-//
-//        while ((line = rd.readLine()) != null) {
-//            result.append(line);
-//            syncFlag = true;
-//        }
-//        rd.close();
-//        if(role.equals("Verifier"))
-//            writeToFile(DATA_PATH + "vip.json", result.toString(), false);
-//        else
-//            writeToFile("vip.json", result.toString(), false);
-//        return syncFlag;
-//    }
 
     public static void changePath() throws JSONException {
         Functions.pathSet();
@@ -142,63 +116,8 @@ public class DIDFunctions {
             else
                 return "Failure";
         }
-        else return "Failure";
-
-//        //Get all members from vip.json
-//        String vipFile = readFile(DATA_PATH + "vip.json");
-//        JSONArray vipArray = new JSONArray(vipFile);
-//
-//        JSONArray contactMembers = new JSONArray();
-//        for(int i = 0; i < vipArray.length(); i++){
-//            JSONObject object = vipArray.getJSONObject(i);
-//            if(object.getString("role").equals("Verifier") && !object.getString("ip").equals(ip)){
-//                contactMembers.put(object.getString("peerid"));
-//            }
-//        }
-//
-//        JSONObject dataToQuorum = new JSONObject();
-//
-//        //Create data to send the other verifiers
-//        String didFile = readFile(DATA_PATH + "DID.json");
-//        JSONArray didArray = new JSONArray(didFile);
-//        JSONObject didObject = didArray.getJSONObject(0);
-//        didObject.put("ip", ip);
-//        dataToQuorum.put("data", didObject);
-//
-//        //Contact all other verifiers
-//        int count = 0;
-//        String[] verifierCount = ContactNodes.contact(contactMembers, dataToQuorum);
-//
-//        //TODO: resp - true r false
-//        //check the number of signatures verified
-//        if (verifierCount.length == contactMembers.length()) {
-//            for(int i=0; i< verifierCount.length; i++) {
-//                JSONObject object = new JSONObject(verifierCount[i]);
-//                if(object.get("count").equals(contactMembers.length()))
-//                    count++;
-//            }
-//        }
-//
-//        //if all verifiers count = 7, then change in the DataTable and Vip.json
-//        if (count == contactMembers.length()) {
-//            String dataTableFile = readFile(DATA_PATH + "DataTable.json");
-//            JSONArray dataTableArray = new JSONArray(dataTableFile);
-//            JSONObject dataTableObject = dataTableArray.getJSONObject(0);
-//            dataTableObject.put("signHash", fileHash);
-//            writeToFile(DATA_PATH + "DataTable.json", new JSONArray().put(dataTableObject).toString(), false);
-//            JSONArray newVipArray = new JSONArray();
-//            for(int k = 0; k < vipArray.length(); k++){
-//                JSONObject vipObject = vipArray.getJSONObject(k);
-//                vipObject.put("status", true);
-//                newVipArray.put(vipObject);
-//            }
-//            writeToFile(DATA_PATH + "vip.json", newVipArray.toString(), false);
-//            return "Verifiers Agreed";
-//        }
-//        //count doesnot match - exit
-//        else {
-//            return "Invalid Signatures";
-//        }
+        else 
+            return "Failure";
     }
 
     public static String userDID(String ip) throws JSONException, IOException {
-- 
GitLab