- const filePath = path.join(`${bytomdDataPath}/config.toml`)
-
- fs.stat(`${filePath}`, function(err) {
- if(err == null) {
- log.info('Bytomd Network has been inited')
- global.fileExist = true
- setBytomMining()
-
- let genesisFile = fs.readFileSync(filePath)
- genesisFile = toml.parse(genesisFile)
-
- global.networkStatus = genesisFile.chain_id
-
- } else if(err.code == 'ENOENT') {
- //wait for the int network call
- log.info('Init Bytomd Network')
- ipcMain.on('bytomdInitNetwork', (event, arg) => {
- setBytomInit( event, arg )
- global.networkStatus = arg
- })
- } else {
- log.error('Some other error: ', err.code)
- }
- })
+ const filePath = path.join(`${Settings.bytomdDataPath}/config.toml`)
+ if (fs.existsSync(filePath)) {
+ log.info('Bytomd Network has been inited')
+ global.fileExist = true
+ setBytomNode()
+ }else {
+ log.info('Init Bytomd Network...')
+ ipcMain.on('bytomdInitNetwork', (event, arg) => {
+ setBytomInit( event, arg )
+ })
+ }