mirror of
https://gitee.com/BDWare/cm
synced 2025-01-10 01:44:04 +00:00
update contract manager
This commit is contained in:
parent
487697aa87
commit
9cf42f1381
@ -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'
|
||||
}
|
||||
|
@ -428,10 +428,6 @@ public class ContractClient {
|
||||
}
|
||||
|
||||
|
||||
public String signResult(String result) {
|
||||
return contractMeta.contract.signResult(result);
|
||||
}
|
||||
|
||||
public String getPubkey() {
|
||||
return contractMeta.contract.getPublicKey();
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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<MultiContractMeta> {
|
||||
static final String dbName = CMTables.UnitContracts.toString();
|
||||
static final String prefix = "Multi_C_Meta_";
|
||||
@ -49,4 +52,14 @@ public class MultiContractRecorder extends StatusRecorder<MultiContractMeta> {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void removeNotExist(ContractStatusRecorder statusRecorder) {
|
||||
Set<MultiContractMeta> toRemove = new HashSet<>();
|
||||
for (String key : getStatus().keySet()) {
|
||||
if (statusRecorder.getContractMeta(key) == null)
|
||||
toRemove.add(getStatus().get(key));
|
||||
}
|
||||
for (MultiContractMeta meta : toRemove)
|
||||
remove(meta);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user