From 32cc66dad162252eb17b695720e24aca80ebee0b Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Tue, 22 Mar 2022 23:52:02 +0800 Subject: [PATCH] support ledgerparams add startContract at cmconfig.json add docker scripts --- src/main/java/org/bdware/sc/ChainOpener.java | 4 ++++ src/main/java/org/bdware/sc/ContractManager.java | 5 +++++ src/main/java/org/bdware/sc/handler/ManagerHandler.java | 7 ++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bdware/sc/ChainOpener.java b/src/main/java/org/bdware/sc/ChainOpener.java index 9a9ab5b..5ef239f 100644 --- a/src/main/java/org/bdware/sc/ChainOpener.java +++ b/src/main/java/org/bdware/sc/ChainOpener.java @@ -1,10 +1,12 @@ package org.bdware.sc; +import com.google.gson.JsonElement; import org.bdware.sc.bean.ContractRequest; import org.bdware.sc.conn.OnHashCallback; public interface ChainOpener { void reRegister(String doid); + String register(String arg); void writeContractResultToLocalAndLedger( @@ -29,4 +31,6 @@ public interface ChainOpener { String requestID, String contractID, String namedLedger); + + JsonElement getLedgerParams(); } diff --git a/src/main/java/org/bdware/sc/ContractManager.java b/src/main/java/org/bdware/sc/ContractManager.java index 8ef572d..6ed3def 100644 --- a/src/main/java/org/bdware/sc/ContractManager.java +++ b/src/main/java/org/bdware/sc/ContractManager.java @@ -1,5 +1,6 @@ package org.bdware.sc; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import io.netty.channel.Channel; @@ -2198,6 +2199,10 @@ public class ContractManager { eventBroker.doSubscribe(topic, new WSClientConsumer(channel)); } + public JsonElement getLedgerParams() { + return chainOpener.getLedgerParams(); + } + // 合约状态 static class StrCollector extends ResultCallback { diff --git a/src/main/java/org/bdware/sc/handler/ManagerHandler.java b/src/main/java/org/bdware/sc/handler/ManagerHandler.java index 91770ca..28bb005 100644 --- a/src/main/java/org/bdware/sc/handler/ManagerHandler.java +++ b/src/main/java/org/bdware/sc/handler/ManagerHandler.java @@ -6,7 +6,6 @@ import org.bdware.sc.bean.ContractRequest; import org.bdware.sc.conn.Description; import org.bdware.sc.conn.MsgHandler; import org.bdware.sc.conn.ResultCallback; -import org.bdware.sc.event.REvent; import org.bdware.sc.get.GetMessage; import org.bdware.sc.util.JsonUtil; @@ -89,4 +88,10 @@ public class ManagerHandler extends MsgHandler { ContractRequest cr = JsonUtil.fromJson(msg.arg, ContractRequest.class); 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()); + } }