Skip to content

Commit

Permalink
Merge pull request #172 from WeBankFinTech/bugfix/txn-timeouts-revive
Browse files Browse the repository at this point in the history
Reset default tx timeout for v2 and upgrade web3sdk to latest
  • Loading branch information
chenhaozx committed Apr 20, 2020
2 parents 2a80034 + 9e66e42 commit e35eb93
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ dependencies {
exclude group: "org.fisco-bcos", module: "web3sdk"
exclude group: "org.slf4j", module: "slf4j-log4j12"
}
compile("org.fisco-bcos:web3sdk:2.1.3"){
exclude group:"io.netty"
compile("org.fisco-bcos:web3sdk:2.3.0"){
// exclude group: "io.netty"
exclude group: "org.slf4j", module: "slf4j-log4j12"
}
compile files("lib/WeDPR-Java-SDK.jar")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

import com.webank.weid.config.FiscoConfig;
import com.webank.weid.constant.ErrorCode;
import com.webank.weid.constant.WeIdConstant;
import com.webank.weid.exception.InitWeb3jException;
import com.webank.weid.exception.PrivateKeyIllegalException;
import com.webank.weid.exception.WeIdBaseException;
Expand Down Expand Up @@ -118,6 +119,7 @@ protected void initWeb3j() {

ChannelEthereumService channelEthereumService = new ChannelEthereumService();
channelEthereumService.setChannelService(service);
channelEthereumService.setTimeout(WeIdConstant.TRANSACTION_RECEIPT_TIMEOUT * 1000);
web3j = Web3j.build(channelEthereumService, service.getGroupId());
if (web3j == null) {
logger.error("[WeServiceImplV2] web3j init failed. ");
Expand Down Expand Up @@ -191,10 +193,11 @@ public int getBlockNumber() throws IOException {
public String getVersion() throws IOException {
return this.getWeb3j().getNodeVersion().send().getNodeVersion().getVersion();
}


@Override
protected String queryBucketFromCns() throws WeIdBaseException {
try {
List<CnsInfo> cnsInfoList = cnsService.queryCnsByNameAndVersion(CNS_NAME, CNS_VERSION);
List<CnsInfo> cnsInfoList = cnsService.queryCnsByNameAndVersion(CNS_NAME, CNS_VERSION);
if (cnsInfoList.size() == 0) {
logger.warn("[queryBucketFromCns] can not find data from CNS.");
return StringUtils.EMPTY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import org.apache.commons.collections4.CollectionUtils;
Expand All @@ -44,6 +45,7 @@

import com.webank.weid.constant.ErrorCode;
import com.webank.weid.constant.ResolveEventLogStatus;
import com.webank.weid.constant.WeIdConstant;
import com.webank.weid.contract.v2.EvidenceContract;
import com.webank.weid.contract.v2.EvidenceContract.EvidenceAttributeChangedEventResponse;
import com.webank.weid.protocol.base.EvidenceInfo;
Expand Down Expand Up @@ -193,7 +195,7 @@ public ResponseData<List<Boolean>> batchCreateEvidence(
sigList,
logList,
timestampList
).send();
).sendAsync().get(WeIdConstant.TRANSACTION_RECEIPT_TIMEOUT, TimeUnit.SECONDS);

TransactionInfo info = new TransactionInfo(receipt);
List<EvidenceAttributeChangedEventResponse> eventList =
Expand Down Expand Up @@ -271,7 +273,7 @@ public ResponseData<List<Boolean>> batchCreateEvidenceWithCustomKey(
logList,
timestampList,
customKeyList
).send();
).sendAsync().get(WeIdConstant.TRANSACTION_RECEIPT_TIMEOUT, TimeUnit.SECONDS);

TransactionInfo info = new TransactionInfo(receipt);
List<EvidenceAttributeChangedEventResponse> eventList =
Expand Down

0 comments on commit e35eb93

Please sign in to comment.