use of com.jd.blockchain.consensus.bftsmart.client.BftsmartClientConfig in project jdchain-core by blockchain-jd-com.
the class ProxyClientTest method proxyClientSend.
public void proxyClientSend(BftsmartNodeServer nodeServer) {
BftsmartClientIncomingConfig clientIncomingConfig = new BftsmartClientIncomingConfig();
BlockchainKeypair keyPair = BlockchainKeyGenerator.getInstance().generate();
clientIncomingConfig.setPubKey(keyPair.getPubKey());
clientIncomingConfig.setSessionCredential(new BftsmartSessionCredentialConfig(0, 10, System.currentTimeMillis()));
clientIncomingConfig.setViewSettings(nodeServer.getConsensusSetting());
clientIncomingConfig.setTomConfig(BinarySerializeUtils.serialize(nodeServer.getTomConfig()));
clientIncomingConfig.setTopology(BinarySerializeUtils.serialize(nodeServer.getTopology()));
BftsmartClientConfig clientSettings = new BftsmartClientConfig(clientIncomingConfig);
BftsmartConsensusClient consensusClient = new BftsmartConsensusClient(clientSettings);
bytes = new byte[1024];
BftsmartMessageService messageService = (BftsmartMessageService) consensusClient.getMessageService();
for (int j = 0; j < number; j++) {
txSendPools.execute(() -> {
random.nextBytes(bytes);
messageService.sendOrdered(bytes);
});
}
}
Aggregations