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);
}
public String getContract() {
return JsonUtil.toJson(contract);
public Contract getContract() {
return contract;
}
public String getPID() {

View File

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

View File

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

View File

@ -104,8 +104,10 @@ public class ContractHandler extends MsgHandler implements Runnable {
@Description("set members")
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")
public void getContractName(GetMessage msg, ResultCallback cb) {
cb.onResult(cs.getContractName());
@ -232,7 +234,7 @@ public class ContractHandler extends MsgHandler implements Runnable {
@Description("get contract")
public void getContract(GetMessage msg, ResultCallback cb) {
cb.onResult(cs.getContract());
cb.onResult(JsonUtil.toJson(cs.getContract()));
}
@Description("setPID")