Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/java/org/fisco/bcos/sdk/v3/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ static Client build(String groupId, ConfigOption configOption, long nativePointe
*/
Boolean isAuthCheck();

/**
* Whether is committee enable in chain
*
* @return true when chain can use committee
*/
Boolean isEnableCommittee();

Boolean isSerialExecute();
/**
* get groupId of the client
Expand Down
19 changes: 18 additions & 1 deletion src/main/java/org/fisco/bcos/sdk/v3/client/ClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.fisco.bcos.sdk.v3.client.protocol.response.SystemConfig;
import org.fisco.bcos.sdk.v3.client.protocol.response.TotalTransactionCount;
import org.fisco.bcos.sdk.v3.config.ConfigOption;
import org.fisco.bcos.sdk.v3.contract.precompiled.sysconfig.SystemConfigService;
import org.fisco.bcos.sdk.v3.crypto.CryptoSuite;
import org.fisco.bcos.sdk.v3.model.CryptoType;
import org.fisco.bcos.sdk.v3.model.EnumNodeVersion;
Expand All @@ -75,6 +76,7 @@ public class ClientImpl implements Client {
private String chainID;
private Boolean wasm;
private Boolean authCheck = false;
private Boolean enableCommittee = false;
private boolean serialExecute;
private Boolean smCrypto;
private String extraData = "";
Expand Down Expand Up @@ -121,11 +123,21 @@ protected void initGroupInfo() {
this.serialExecute = groupNodeIniConfig.getExecutor().isSerialExecute();

this.authCheck = groupNodeIniConfig.getExecutor().isAuthCheck();
this.enableCommittee = groupNodeIniConfig.getExecutor().isAuthCheck();
if (EnumNodeVersion.valueOf((int) compatibilityVersion)
.toVersionObj()
.compareTo(EnumNodeVersion.BCOS_3_3_0.toVersionObj())
>= 0) {
this.authCheck = true;
this.enableCommittee = true;
try {
SystemConfig systemConfig = getSystemConfigByKey(SystemConfigService.AUTH_STATUS);
int value = Integer.parseInt(systemConfig.getSystemConfig().getValue());
if (value != 0) {
this.authCheck = true;
}
} catch (Exception ignored) {
this.authCheck = false;
}
}
this.smCrypto = groupNodeIniConfig.getChain().isSmCrypto();
this.blockNumber = this.getBlockNumber().getBlockNumber().longValue();
Expand Down Expand Up @@ -230,6 +242,11 @@ public Boolean isAuthCheck() {
return this.authCheck;
}

@Override
public Boolean isEnableCommittee() {
return this.enableCommittee;
}

@Override
public Boolean isSerialExecute() {
return this.serialExecute;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,7 @@ public Call executeCall(String from, String to, byte[] encodedFunction) {
@Override
public Call executeCallWithSign(String from, String to, byte[] encodedFunction) {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
if (client.isWASM()) {
outputStream.write(Hex.decode(cryptoSuite.hash(to)));
} else {
outputStream.write(Hex.decode(to));
}
outputStream.write(to.getBytes());
outputStream.write(encodedFunction);
byte[] hash = this.cryptoSuite.hash(outputStream.toByteArray());
SignatureResult sign = this.cryptoSuite.sign(hash, this.cryptoSuite.getCryptoKeyPair());
Expand Down