Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fileprivate func startNode() throws {
- var error: NSError?
- let bootNodes = GethNewEnodesEmpty()
- bootNodes?.append(GethNewEnode(Constants.Ethereum.enodeRawUrl, &error))
- let genesisPath = Bundle.main.path(forResource: "rinkeby", ofType: "json")
- let genesis = try! String(contentsOfFile: genesisPath!, encoding: String.Encoding.utf8)
- let config = GethNewNodeConfig()
- config?.setBootstrapNodes(bootNodes)
- config?.setEthereumGenesis(genesis)
- config?.setEthereumNetworkID(4)
- let datadir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
- ethereumNode = GethNewNode(datadir, config, &error)
- try ethereumNode.start()
- if let error = error {
- throw EthereumError.nodeStartFailed(error: error)
- }
- }
- fileprivate func startSync() throws {
- if let syncProgress = try? self.ethereumNode.getEthereumClient().syncProgress(self.ethereumContext) {
- self.isSyncMode = true
- } else if self.isSyncMode {
- self.isSyncMode = false
- }
- }
Add Comment
Please, Sign In to add comment