Skip to content

Commit

Permalink
Update getPreConsensusCount
Browse files Browse the repository at this point in the history
  • Loading branch information
leej1012 committed Jun 21, 2024
1 parent e74dfd8 commit e7d0b77
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.io.ByteArrayInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -150,17 +151,17 @@ public int getPreConsensusCount() {
Configuration preConfiguration = getPreConfiguration();
return preConfiguration.K;
} catch (Exception e) {
log.warn("Getting authorize info failed: {}", e.getMessage());
log.warn("getPreConsensusCount failed: {}", e.getMessage());
switchSyncNode();
log.info("Getting authorize info again");
log.info("getPreConsensusCount again");
return getPreConsensusCount();
}
}

public Configuration getPreConfiguration() throws Exception {
String res = sdk.getConnect().getStorage(Helper.reverse(contractAddress), Helper.toHexString("preConfig".getBytes()));
if (res == null) {
return null;
if (!StringUtils.hasLength(res)) {
res = sdk.getConnect().getStorage(Helper.reverse(contractAddress), Helper.toHexString("vbftConfig".getBytes()));
}
Configuration configuration = new Configuration();
ByteArrayInputStream in = new ByteArrayInputStream(Helper.hexToBytes(res));
Expand Down

0 comments on commit e7d0b77

Please sign in to comment.