use of com.jd.blockchain.consensus.ConsensusProvider in project jdchain-core by blockchain-jd-com.
the class GatewayQueryServiceHandler method initConsensusSettings.
/**
* 初始化共识配置
*
* @param ledgerAdminInfo 账本元数据
* @return
*/
private ConsensusViewSettings initConsensusSettings(LedgerAdminInfo ledgerAdminInfo) {
String consensusProvider = ledgerAdminInfo.getSettings().getConsensusProvider();
ConsensusProvider provider = ConsensusProviders.getProvider(consensusProvider);
byte[] consensusSettingsBytes = ledgerAdminInfo.getSettings().getConsensusSetting().toBytes();
return consensusSettingsDecorator(provider.getSettingsFactory().getConsensusSettingsEncoder().decode(consensusSettingsBytes));
}
use of com.jd.blockchain.consensus.ConsensusProvider in project jdchain-core by blockchain-jd-com.
the class LedgerInitConfiguration method createConsensusConfig.
private static ConsensusConfig createConsensusConfig(LedgerInitProperties initProps) {
ConsensusProvider consensusProvider = ConsensusProviders.getProvider(initProps.getConsensusProvider());
Properties csProps = initProps.getConsensusConfig();
ConsensusViewSettings protocolSettings = consensusProvider.getSettingsFactory().getConsensusSettingsBuilder().createSettings(csProps, ParticipantReplica.wrap(initProps.getConsensusParticipantNodes()));
ConsensusConfig config = new ConsensusConfig();
config.setProvider(consensusProvider);
config.setProtocolSettings(protocolSettings);
return config;
}
use of com.jd.blockchain.consensus.ConsensusProvider in project jdchain-core by blockchain-jd-com.
the class IParticipantManagerService method getConsensusSetting.
default ConsensusViewSettings getConsensusSetting(ParticipantContext context) {
ConsensusProvider provider = ConsensusProviders.getProvider(context.provider());
Bytes csSettingBytes = context.ledgerAdminInfo().getSettings().getConsensusSetting();
return provider.getSettingsFactory().getConsensusSettingsEncoder().decode(csSettingBytes.toBytes());
}
Aggregations