support ledgerparams

add startContract at cmconfig.json
add docker scripts
This commit is contained in:
CaiHQ 2022-03-22 23:52:02 +08:00
parent a2f8ab528b
commit 32cc66dad1
3 changed files with 15 additions and 1 deletions

View File

@ -1,10 +1,12 @@
package org.bdware.sc; package org.bdware.sc;
import com.google.gson.JsonElement;
import org.bdware.sc.bean.ContractRequest; import org.bdware.sc.bean.ContractRequest;
import org.bdware.sc.conn.OnHashCallback; import org.bdware.sc.conn.OnHashCallback;
public interface ChainOpener { public interface ChainOpener {
void reRegister(String doid); void reRegister(String doid);
String register(String arg); String register(String arg);
void writeContractResultToLocalAndLedger( void writeContractResultToLocalAndLedger(
@ -29,4 +31,6 @@ public interface ChainOpener {
String requestID, String requestID,
String contractID, String contractID,
String namedLedger); String namedLedger);
JsonElement getLedgerParams();
} }

View File

@ -1,5 +1,6 @@
package org.bdware.sc; package org.bdware.sc;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive; import com.google.gson.JsonPrimitive;
import io.netty.channel.Channel; import io.netty.channel.Channel;
@ -2198,6 +2199,10 @@ public class ContractManager {
eventBroker.doSubscribe(topic, new WSClientConsumer(channel)); eventBroker.doSubscribe(topic, new WSClientConsumer(channel));
} }
public JsonElement getLedgerParams() {
return chainOpener.getLedgerParams();
}
// 合约状态 // 合约状态
static class StrCollector extends ResultCallback { static class StrCollector extends ResultCallback {

View File

@ -6,7 +6,6 @@ import org.bdware.sc.bean.ContractRequest;
import org.bdware.sc.conn.Description; import org.bdware.sc.conn.Description;
import org.bdware.sc.conn.MsgHandler; import org.bdware.sc.conn.MsgHandler;
import org.bdware.sc.conn.ResultCallback; import org.bdware.sc.conn.ResultCallback;
import org.bdware.sc.event.REvent;
import org.bdware.sc.get.GetMessage; import org.bdware.sc.get.GetMessage;
import org.bdware.sc.util.JsonUtil; import org.bdware.sc.util.JsonUtil;
@ -89,4 +88,10 @@ public class ManagerHandler extends MsgHandler {
ContractRequest cr = JsonUtil.fromJson(msg.arg, ContractRequest.class); ContractRequest cr = JsonUtil.fromJson(msg.arg, ContractRequest.class);
cb.onResult(cm.addDEMember(cr.getContractID(), cr.getArg().getAsString())); cb.onResult(cm.addDEMember(cr.getContractID(), cr.getArg().getAsString()));
} }
@Description("add distributed execution member, sample: {contractID:id/name, arg:ipAndPort}")
public void getLedgerParams(GetMessage msg, ResultCallback cb) {
cb.onResult(ContractManager.instance.getLedgerParams().toString());
}
} }