refactor: prune unused code

This commit is contained in:
Frank.R.Wu 2021-11-01 15:12:50 +08:00
parent d70490b5fb
commit a8abd53446
3 changed files with 15 additions and 43 deletions

View File

@ -264,9 +264,9 @@ public class DesktopEngine extends JSEngine {
for (String topic : contractNode.events.keySet()) { for (String topic : contractNode.events.keySet()) {
compileEventFunction(topic, topic, contractNode.events.get(topic)); compileEventFunction(topic, topic, contractNode.events.get(topic));
} }
for (String log : contractNode.logs.keySet()) { for (String logName : contractNode.logs.keySet()) {
String topic = HashUtil.sha3(contract.getID() + log); String topic = HashUtil.sha3(contract.getID(), logName);
compileEventFunction(log, topic, contractNode.logs.get(log)); compileEventFunction(logName, topic, contractNode.logs.get(logName));
} }
for (ClassNode cn : contractNode.getClzs()) { for (ClassNode cn : contractNode.getClzs()) {
try { try {

View File

@ -109,47 +109,19 @@ public class SyncMechUtil {
} }
public void clearAllFiles() { public void clearAllFiles() {
File file = new File(syncDir); cleanDirectory(syncDir);
if (file.isDirectory()) { cleanDirectory(crDir);
String[] children = file.list(); cleanDirectory(memoryDir);
for (int i = 0; i < children.length; i++) { cleanDirectory(traceDir);
File temp = new File(file, children[i]); cleanDirectory(transDir);
temp.delete(); }
}
}
file = new File(crDir); private void cleanDirectory(String path) {
File file = new File(path);
if (file.isDirectory()) { if (file.isDirectory()) {
String[] children = file.list(); String[] children = file.list();
for (int i = 0; i < children.length; i++) { for (String child : children) {
File temp = new File(file, children[i]); File temp = new File(file, child);
temp.delete();
}
}
file = new File(memoryDir);
if (file.isDirectory()) {
String[] children = file.list();
for (int i = 0; i < children.length; i++) {
File temp = new File(file, children[i]);
temp.delete();
}
}
file = new File(traceDir);
if (file.isDirectory()) {
String[] children = file.list();
for (int i = 0; i < children.length; i++) {
File temp = new File(file, children[i]);
temp.delete();
}
}
file = new File(transDir);
if (file.isDirectory()) {
String[] children = file.list();
for (int i = 0; i < children.length; i++) {
File temp = new File(file, children[i]);
temp.delete(); temp.delete();
} }
} }

View File

@ -127,7 +127,7 @@ public class ContractHandler extends MsgHandler implements Runnable {
cb.onResult(result); cb.onResult(result);
} }
@Description("get functionEvaluates ") @Description("get functionEvaluates")
public void functionEvaluates(GetMessage msg, ResultCallback cb) { public void functionEvaluates(GetMessage msg, ResultCallback cb) {
cb.onResult(cs.evaluatesAnalysis(msg.arg)); cb.onResult(cs.evaluatesAnalysis(msg.arg));
} }
@ -137,7 +137,7 @@ public class ContractHandler extends MsgHandler implements Runnable {
cb.onResult(cs.getMemorySet()); cb.onResult(cs.getMemorySet());
} }
@Description("get logType ") @Description("get logType")
public void getLogType(GetMessage msg, ResultCallback cb) { public void getLogType(GetMessage msg, ResultCallback cb) {
cb.onResult(cs.getLogType(msg.arg)); cb.onResult(cs.getLogType(msg.arg));
} }