Allow network metadata without bootstrap nodes

This commit is contained in:
Zahary Karadjov 2020-07-28 13:46:22 +03:00
parent f4c19e303a
commit 6ccfff7d58
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 7 additions and 1 deletions

View File

@ -97,6 +97,7 @@ proc loadEth2NetworkMetadata*(path: string): Eth2NetworkMetadata
configPath = path / "config.yaml" configPath = path / "config.yaml"
depositContractPath = path / "deposit_contract.txt" depositContractPath = path / "deposit_contract.txt"
depositContractBlockPath = path / "deposit_contract_block.txt" depositContractBlockPath = path / "deposit_contract_block.txt"
bootstrapNodesPath = path / "bootstrap_nodes.txt"
runtimePreset = if fileExists(configPath): runtimePreset = if fileExists(configPath):
extractRuntimePreset(configPath, readPresetFile(configPath)) extractRuntimePreset(configPath, readPresetFile(configPath))
@ -113,6 +114,11 @@ proc loadEth2NetworkMetadata*(path: string): Eth2NetworkMetadata
else: else:
default(Eth1BlockHash) default(Eth1BlockHash)
bootstrapNodes = if fileExists(bootstrapNodesPath):
readFile(bootstrapNodesPath).splitLines()
else:
@[]
genesisData = if fileExists(genesisPath): readFile(genesisPath) genesisData = if fileExists(genesisPath): readFile(genesisPath)
else: "" else: ""
@ -120,7 +126,7 @@ proc loadEth2NetworkMetadata*(path: string): Eth2NetworkMetadata
incompatible: false, incompatible: false,
eth1Network: some goerli, eth1Network: some goerli,
runtimePreset: runtimePreset, runtimePreset: runtimePreset,
bootstrapNodes: readFile(path / "bootstrap_nodes.txt").splitLines(), bootstrapNodes: bootstrapNodes,
depositContractAddress: depositContractAddress, depositContractAddress: depositContractAddress,
depositContractDeployedAt: depositContractBlock, depositContractDeployedAt: depositContractBlock,
genesisData: genesisData) genesisData: genesisData)