use of com.jd.blockchain.consensus.bftsmart.service.BftsmartServerSettingConfig in project jdchain-core by blockchain-jd-com.
the class ProxyClientTest method peerStart.
public void peerStart(BftsmartNodeServer[] nodeServers) {
BftsmartNodeSettings[] nodesSettings = new BftsmartNodeSettings[nodeNum];
for (int i = 0; i < nodeNum; i++) {
BlockchainKeypair keyPair = BlockchainKeyGenerator.getInstance().generate();
PubKey pubKey = keyPair.getPubKey();
NetworkAddress peerNodeServ = new NetworkAddress("127.0.0.1", peerStartPort + i * 10);
NodeSettings node = new BftsmartNodeConfig(pubKey, i, peerNodeServ);
nodesSettings[i] = (BftsmartNodeSettings) node;
}
BftsmartConsensusConfig consensusConfig = new BftsmartConsensusConfig(nodesSettings, PropertiesUtils.getOrderedValues(bftsmartConf), 0);
for (int j = 0; j < nodeNum; j++) {
BftsmartServerSettingConfig serverSettings = new BftsmartServerSettingConfig();
serverSettings.setReplicaSettings(nodesSettings[j]);
serverSettings.setConsensusSettings(consensusConfig);
BftsmartNodeServer server = new BftsmartNodeServer(serverSettings, null, null, new MemoryStorage("test"));
nodeServers[j] = server;
nodeStartPools.execute(() -> {
server.start();
startPeer.countDown();
});
}
}
Aggregations