Skip to content

Credits Checks - Type2 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 0 additions & 96 deletions core.iml

This file was deleted.

23 changes: 16 additions & 7 deletions src/main/java/com/rubix/core/Controllers/Basics.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import com.rubix.Consensus.QuorumConsensus;
import com.rubix.Ping.PingCheck;
import com.rubix.Resources.APIHandler;
import com.rubix.Resources.Functions;
import com.rubix.Resources.IPFSNetwork;
import com.rubix.core.Resources.Background;
import com.rubix.core.Resources.QuorumPingReceiveThread;
import com.rubix.core.Resources.Receiver;
import com.rubix.core.Resources.ReceiverPingReceive;
import com.rubix.core.Resources.*;
import io.ipfs.api.IPFS;
import org.json.JSONArray;
import org.json.JSONException;
Expand Down Expand Up @@ -71,6 +69,10 @@ public static String start() throws JSONException, IOException {
Thread quorumPingThread = new Thread(quorumPingReceiveThread);
quorumPingThread.start();

QuorumCreditsThread quorumCredits = new QuorumCreditsThread();
Thread creditsThread = new Thread(quorumCredits);
creditsThread.start();

tokenBank();

System.out.println(repo());
Expand All @@ -92,9 +94,9 @@ public static String start() throws JSONException, IOException {
writeToFile(partTokensFile.toString(), "[]", false);
}

// Background background = new Background();
// Thread backThread = new Thread(background);
// backThread.start();
Background background = new Background();
Thread backThread = new Thread(background);
backThread.start();

JSONObject result = new JSONObject();
JSONObject contentObject = new JSONObject();
Expand Down Expand Up @@ -298,6 +300,13 @@ public static Double tokenParts(@RequestParam("token") String tokenHash) {

}

@RequestMapping(value = "/arrangeQuorum", method = RequestMethod.GET,
produces = {"application/json", "application/xml"})
public static String arrangeQuorum() {
return APIHandler.sortType2Quorum().toString();

}

@RequestMapping(value = {"/validateReceiver"}, method = {RequestMethod.GET}, produces = {"application/json", "application/xml"})
public String validateReceiver(@RequestParam("receiverDID") String receiverDID) throws IOException {
System.out.println(receiverDID);
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/com/rubix/core/Resources/QuorumCreditsThread.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.rubix.core.Resources;

import com.rubix.Ping.QuorumSendCredits;
import org.json.JSONException;

import static com.rubix.Resources.Functions.QUORUM_PORT;
import static com.rubix.Resources.Functions.pathSet;

public class QuorumCreditsThread implements Runnable {
@Override
public void run() {
while (true) {
try {
pathSet();
QuorumSendCredits.sendCredits(QUORUM_PORT + 420);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}