diff --git a/build.gradle b/build.gradle index 18b2e90..cbd48b8 100644 --- a/build.gradle +++ b/build.gradle @@ -29,9 +29,6 @@ sourceCompatibility = 1.8 dependencies { api project(":common") api 'io.prometheus:simpleclient:0.12.0' - api 'org.knowhowlab.osgi:sigar:1.6.5_01' - api 'org.bdware.doip:doip-sdk:1.1.0' - - api fileTree(dir: 'libs', include: '*.jar') + api 'org.hyperic.sigar:sigar:1.6.4' testImplementation 'junit:junit:4.13.2' } diff --git a/src/main/java/org/bdware/sc/ContractClient.java b/src/main/java/org/bdware/sc/ContractClient.java index e4fb730..b938bee 100644 --- a/src/main/java/org/bdware/sc/ContractClient.java +++ b/src/main/java/org/bdware/sc/ContractClient.java @@ -428,10 +428,6 @@ public class ContractClient { } - public String signResult(String result) { - return contractMeta.contract.signResult(result); - } - public String getPubkey() { return contractMeta.contract.getPublicKey(); } diff --git a/src/main/java/org/bdware/sc/ContractManager.java b/src/main/java/org/bdware/sc/ContractManager.java index 90f5627..e4dcaba 100644 --- a/src/main/java/org/bdware/sc/ContractManager.java +++ b/src/main/java/org/bdware/sc/ContractManager.java @@ -32,8 +32,6 @@ import org.zz.gmhelper.SM2KeyPair; import org.zz.gmhelper.SM2Util; import java.io.*; -import java.lang.reflect.Method; -import java.lang.reflect.Parameter; import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.*; @@ -116,6 +114,7 @@ public class ContractManager { eventBroker = new EventBroker(); statusRecorder = new ContractStatusRecorder("./ContractManagerDB"); multiContractRecorder = new MultiContractRecorder("./ContractManagerDB"); + multiContractRecorder.removeNotExist(statusRecorder); projectRecoder = new ProjectRecorder("./ContractManagerDB"); } @@ -985,17 +984,16 @@ public class ContractManager { } private void setContractDOI(Contract c) { - if (DoConfig.callContractUsingDOI) { - ContractManifest cm = YJSPacker.getManifest(c.getScriptStr()); - if (cm != null && cm.doi != null) { - if (!cm.doi.equals("") - && !cm.doi.equals("null") - && c.getType() == ContractExecType.Sole && chainOpener != null) { - c.setDOI(cm.doi); - c.setBuildTime(cm.buildTime); - c.setDoipFlag(true); - chainOpener.reRegister(cm.doi); - } + //@TODO add Automatically register a doi instead. + ContractManifest cm = YJSPacker.getManifest(c.getScriptStr()); + if (cm != null && cm.doi != null) { + if (!cm.doi.equals("") + && !cm.doi.equals("null") + && c.getType() == ContractExecType.Sole && chainOpener != null) { + c.setDOI(cm.doi); + c.setBuildTime(cm.buildTime); + c.setDoipFlag(true); + chainOpener.reRegister(cm.doi); } } else { c.setDoipFlag(false); diff --git a/src/main/java/org/bdware/sc/MultiContractRecorder.java b/src/main/java/org/bdware/sc/MultiContractRecorder.java index 64b8ee4..8d6f779 100644 --- a/src/main/java/org/bdware/sc/MultiContractRecorder.java +++ b/src/main/java/org/bdware/sc/MultiContractRecorder.java @@ -7,6 +7,9 @@ import org.bdware.sc.db.KeyValueDBUtil; import org.bdware.sc.db.StatusRecorder; import org.bdware.sc.units.MultiContractMeta; +import java.util.HashSet; +import java.util.Set; + public class MultiContractRecorder extends StatusRecorder { static final String dbName = CMTables.UnitContracts.toString(); static final String prefix = "Multi_C_Meta_"; @@ -49,4 +52,14 @@ public class MultiContractRecorder extends StatusRecorder { } return ret; } + + public void removeNotExist(ContractStatusRecorder statusRecorder) { + Set toRemove = new HashSet<>(); + for (String key : getStatus().keySet()) { + if (statusRecorder.getContractMeta(key) == null) + toRemove.add(getStatus().get(key)); + } + for (MultiContractMeta meta : toRemove) + remove(meta); + } }