Skip to content

Commit bfa45a6

Browse files
committed
<fix>(client): add enableCommittee option.
1 parent 58cc4e8 commit bfa45a6

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/main/java/org/fisco/bcos/sdk/v3/client/Client.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ static Client build(String groupId, ConfigOption configOption, long nativePointe
133133
*/
134134
Boolean isAuthCheck();
135135

136+
/**
137+
* Whether is committee enable in chain
138+
*
139+
* @return true when chain can use committee
140+
*/
141+
Boolean isEnableCommittee();
142+
136143
Boolean isSerialExecute();
137144
/**
138145
* get groupId of the client

src/main/java/org/fisco/bcos/sdk/v3/client/ClientImpl.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.fisco.bcos.sdk.v3.client.protocol.response.SystemConfig;
5454
import org.fisco.bcos.sdk.v3.client.protocol.response.TotalTransactionCount;
5555
import org.fisco.bcos.sdk.v3.config.ConfigOption;
56+
import org.fisco.bcos.sdk.v3.contract.precompiled.sysconfig.SystemConfigService;
5657
import org.fisco.bcos.sdk.v3.crypto.CryptoSuite;
5758
import org.fisco.bcos.sdk.v3.model.CryptoType;
5859
import org.fisco.bcos.sdk.v3.model.EnumNodeVersion;
@@ -75,6 +76,7 @@ public class ClientImpl implements Client {
7576
private String chainID;
7677
private Boolean wasm;
7778
private Boolean authCheck = false;
79+
private Boolean enableCommittee = false;
7880
private boolean serialExecute;
7981
private Boolean smCrypto;
8082
private String extraData = "";
@@ -121,11 +123,21 @@ protected void initGroupInfo() {
121123
this.serialExecute = groupNodeIniConfig.getExecutor().isSerialExecute();
122124

123125
this.authCheck = groupNodeIniConfig.getExecutor().isAuthCheck();
126+
this.enableCommittee = groupNodeIniConfig.getExecutor().isAuthCheck();
124127
if (EnumNodeVersion.valueOf((int) compatibilityVersion)
125128
.toVersionObj()
126129
.compareTo(EnumNodeVersion.BCOS_3_3_0.toVersionObj())
127130
>= 0) {
128-
this.authCheck = true;
131+
this.enableCommittee = true;
132+
try {
133+
SystemConfig systemConfig = getSystemConfigByKey(SystemConfigService.AUTH_STATUS);
134+
int value = Integer.parseInt(systemConfig.getSystemConfig().getValue());
135+
if (value != 0) {
136+
this.authCheck = true;
137+
}
138+
} catch (Exception ignored) {
139+
this.authCheck = false;
140+
}
129141
}
130142
this.smCrypto = groupNodeIniConfig.getChain().isSmCrypto();
131143
this.blockNumber = this.getBlockNumber().getBlockNumber().longValue();
@@ -230,6 +242,11 @@ public Boolean isAuthCheck() {
230242
return this.authCheck;
231243
}
232244

245+
@Override
246+
public Boolean isEnableCommittee() {
247+
return this.enableCommittee;
248+
}
249+
233250
@Override
234251
public Boolean isSerialExecute() {
235252
return this.serialExecute;

0 commit comments

Comments
 (0)