Search in sources :

Example 1 with GenesisBlock

use of io.nuls.consensus.entity.genesis.GenesisBlock in project nuls by nuls-io.

the class ConsensusManager method loadConfigration.

private void loadConfigration() {
    Block bestBlock = null;
    Block genesisBlock = GenesisBlock.getInstance();
    NulsContext.getInstance().setGenesisBlock(genesisBlock);
    try {
        bestBlock = blockStorageService.getBlock(blockStorageService.getBestHeight());
    } catch (Exception e) {
        Log.error(e);
    }
    if (bestBlock == null) {
        bestBlock = genesisBlock;
    }
    NulsContext.getInstance().setBestBlock(bestBlock);
    partakePacking = NulsContext.MODULES_CONFIG.getCfgValue(PocConsensusConstant.CFG_CONSENSUS_SECTION, PocConsensusConstant.PROPERTY_PARTAKE_PACKING, false);
    seedNodeList = new ArrayList<>();
    Set<String> seedAddressSet = new HashSet<>();
    String addresses = NulsContext.MODULES_CONFIG.getCfgValue(PocConsensusConstant.CFG_CONSENSUS_SECTION, PocConsensusConstant.PROPERTY_SEED_NODES, "");
    if (StringUtils.isBlank(addresses)) {
        return;
    }
    String[] array = addresses.split(PocConsensusConstant.SEED_NODES_DELIMITER);
    if (null == array) {
        return;
    }
    for (String address : array) {
        seedAddressSet.add(address);
    }
    this.seedNodeList.addAll(seedAddressSet);
}
Also used : GenesisBlock(io.nuls.consensus.entity.genesis.GenesisBlock) Block(io.nuls.core.chain.entity.Block) HashSet(java.util.HashSet)

Aggregations

GenesisBlock (io.nuls.consensus.entity.genesis.GenesisBlock)1 Block (io.nuls.core.chain.entity.Block)1 HashSet (java.util.HashSet)1