fix: _mul misuse bugs

This commit is contained in:
CaiHQ 2022-06-29 02:29:45 +08:00
parent df94bedbae
commit 14db4a8f6c
4 changed files with 11 additions and 7 deletions

View File

@ -1165,8 +1165,8 @@ public class ContractProcess {
return JsonUtil.toJson(ret); return JsonUtil.toJson(ret);
} }
public String getContract() { public Contract getContract() {
return JsonUtil.toJson(contract); return contract;
} }
public String getPID() { public String getPID() {

View File

@ -5,6 +5,7 @@ import groovy.util.ScriptException;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.bdware.sc.ContractProcess; import org.bdware.sc.ContractProcess;
import org.bdware.sc.bean.ContractExecType;
import org.bdware.sc.bean.ContractRequest; import org.bdware.sc.bean.ContractRequest;
import org.bdware.sc.conn.ResultCallback; import org.bdware.sc.conn.ResultCallback;
import org.bdware.sc.conn.SocketGet; import org.bdware.sc.conn.SocketGet;
@ -240,7 +241,8 @@ public class JavaScriptEntry {
app.doSignature(keyPair); app.doSignature(keyPair);
app.setRequesterDOI(doi); app.setRequesterDOI(doi);
app.setFromDebug(isDebug); app.setFromDebug(isDebug);
if (numOfCopies > 1) { ContractExecType type = ContractProcess.instance.getContract().getType();
if (type.needSeq()) {
app.setRequestID( app.setRequestID(
String.format( String.format(
"%d_%d_%d_%d_mul", "%d_%d_%d_%d_mul",

View File

@ -515,7 +515,7 @@ public class DesktopEngine extends JSEngine {
List<REvent> msgList = JavaScriptEntry.msgList; List<REvent> msgList = JavaScriptEntry.msgList;
JavaScriptEntry.msgList = null; JavaScriptEntry.msgList = null;
if (!msgList.isEmpty()) { if (msgList != null && !msgList.isEmpty()) {
contractRes.events = msgList; contractRes.events = msgList;
contractRes.eventRelated = true; contractRes.eventRelated = true;
} }

View File

@ -104,8 +104,10 @@ public class ContractHandler extends MsgHandler implements Runnable {
@Description("set members") @Description("set members")
public void setMembers(GetMessage msg, ResultCallback cb) { public void setMembers(GetMessage msg, ResultCallback cb) {
cb.onResult(cs.setMembers(JsonUtil.fromJson(msg.arg,new TypeToken<List<String>>(){}.getType()))); cb.onResult(cs.setMembers(JsonUtil.fromJson(msg.arg, new TypeToken<List<String>>() {
}.getType())));
} }
@Description("get current contract name") @Description("get current contract name")
public void getContractName(GetMessage msg, ResultCallback cb) { public void getContractName(GetMessage msg, ResultCallback cb) {
cb.onResult(cs.getContractName()); cb.onResult(cs.getContractName());
@ -116,7 +118,7 @@ public class ContractHandler extends MsgHandler implements Runnable {
cb.onResult(cs.setContract(JsonUtil.fromJson(msg.arg, Contract.class))); cb.onResult(cs.setContract(JsonUtil.fromJson(msg.arg, Contract.class)));
} }
@Description(value = "execute contract",isAsync = true) @Description(value = "execute contract", isAsync = true)
public void executeContract(GetMessage msg, ResultCallback cb) { public void executeContract(GetMessage msg, ResultCallback cb) {
cb.onResult(cs.executeContract(msg.arg)); cb.onResult(cs.executeContract(msg.arg));
} }
@ -232,7 +234,7 @@ public class ContractHandler extends MsgHandler implements Runnable {
@Description("get contract") @Description("get contract")
public void getContract(GetMessage msg, ResultCallback cb) { public void getContract(GetMessage msg, ResultCallback cb) {
cb.onResult(cs.getContract()); cb.onResult(JsonUtil.toJson(cs.getContract()));
} }
@Description("setPID") @Description("setPID")