static public void start() { // Initialize the crypto manager CryptoManager.initLib(); // Prepare the wallet string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal); walletStorage = new WalletStorage(Path.Combine(path, Config.walletFile)); // Initialize the wallet state walletState = new WalletState(); // Prepare the local storage localStorage = new SPIXI.Storage.LocalStorage(); // Read the account file localStorage.readAccountFile(); // Start the network queue NetworkQueue.start(); // Prepare the stream processor StreamProcessor.initialize(); // Start the keepalive thread PresenceList.startKeepAlive(); // Setup a timer to handle routine updates mainLoopTimer = new System.Timers.Timer(2500); mainLoopTimer.Elapsed += new ElapsedEventHandler(onUpdate); mainLoopTimer.Start(); }
static public void start() { // Generate presence list PresenceList.init(IxianHandler.publicIP, 0, 'C'); // Prepare the local storage localStorage = new SPIXI.Storage.LocalStorage(Config.spixiUserFolder); // Read the account file localStorage.readAccountFile(); // Start the network queue NetworkQueue.start(); // Prepare the stream processor StreamProcessor.initialize(); // Start the keepalive thread PresenceList.startKeepAlive(); // Start the transfer manager TransferManager.start(); startCounter++; // Setup a timer to handle routine updates mainLoopTimer = new System.Timers.Timer(2500); mainLoopTimer.Elapsed += new ElapsedEventHandler(onUpdate); mainLoopTimer.Start(); }
public void start() { PresenceList.init(IxianHandler.publicIP, 0, 'C'); // Start the network queue NetworkQueue.start(); // Start the network client manager NetworkClientManager.start(); // Start the keepalive thread //PresenceList.startKeepAlive(); }
public void start(bool verboseConsoleOutput) { // Generate presence list PresenceList.init(IxianHandler.publicIP, Config.serverPort, 'R'); // Start the network queue NetworkQueue.start(); ActivityStorage.prepareStorage(); if (Config.apiBinds.Count == 0) { Config.apiBinds.Add("http://localhost:" + Config.apiPort + "/"); } // Start the HTTP JSON API server apiServer = new APIServer(Config.apiBinds, Config.apiUsers, Config.apiAllowedIps); // Prepare stats screen ConsoleHelpers.verboseConsoleOutput = verboseConsoleOutput; Logging.consoleOutput = verboseConsoleOutput; Logging.flush(); if (ConsoleHelpers.verboseConsoleOutput == false) { statsConsoleScreen.clearScreen(); } // Check for test client mode if (Config.isTestClient) { TestClientNode.start(); return; } // Start the node stream server NetworkServer.beginNetworkOperations(); // Start the network client manager NetworkClientManager.start(); // Start the keepalive thread PresenceList.startKeepAlive(); // Start the maintenance thread maintenanceThread = new Thread(performMaintenance); maintenanceThread.Start(); }
static public void synchronize() { // Clear everything and force a resynchronization Logging.info("\n\n\tSynchronizing to network...\n"); blockProcessor.stopOperation(); blockProcessor = new BlockProcessor(); blockChain = new BlockChain(); walletState.clear(); TransactionPool.clear(); NetworkQueue.stop(); NetworkQueue.start(); // Finally, reconnect to the network CoreNetworkUtils.reconnect(); }
static public void start(bool verboseConsoleOutput) { // Network configuration NetworkUtils.configureNetwork(); PresenceList.generatePresenceList(Config.publicServerIP, 'R'); // Start the network queue NetworkQueue.start(); ActivityStorage.prepareStorage(); // Start the HTTP JSON API server apiServer = new APIServer(); // Prepare stats screen Config.verboseConsoleOutput = verboseConsoleOutput; Logging.consoleOutput = verboseConsoleOutput; Logging.flush(); if (Config.verboseConsoleOutput == false) { statsConsoleScreen.clearScreen(); } // Check for test client mode if (Config.isTestClient) { TestClientNode.start(); return; } // Start the node stream server NetworkServer.beginNetworkOperations(); // Start the network client manager NetworkClientManager.start(); // Start the keepalive thread PresenceList.startKeepAlive(); // Start the maintenance thread maintenanceThread = new Thread(performMaintenance); maintenanceThread.Start(); }
static public void start() { if (running) { return; } running = true; // Generate presence list PresenceList.init(IxianHandler.publicIP, 0, 'C'); // Start local storage localStorage.start(); // Start the network queue NetworkQueue.start(); // Prepare the stream processor StreamProcessor.initialize(); // Start the keepalive thread PresenceList.startKeepAlive(); // Start the transfer manager TransferManager.start(); // Start TIV tiv.start(); customAppManager.start(); startCounter++; // Setup a timer to handle routine updates mainLoopTimer = new System.Timers.Timer(2500); mainLoopTimer.Elapsed += new ElapsedEventHandler(onUpdate); mainLoopTimer.Start(); // Set the identifier tag string tag = Base58Check.Base58CheckEncoding.EncodePlain(IxianHandler.getWalletStorage().getPrimaryAddress()); DependencyService.Get <IPushService>().setTag(tag); }
public void start() { PresenceList.init(IxianHandler.publicIP, 0, 'C'); // Start the network queue NetworkQueue.start(); // Start the network client manager NetworkClientManager.start(2); // Start TIV if (generatedNewWallet || !File.Exists(Config.walletFile)) { generatedNewWallet = false; tiv.start(""); } else { tiv.start("", 0, null); } }
static public void start() { if (running) { return; } Logging.info("Starting node"); running = true; UpdateVerify.init(Config.checkVersionUrl, Config.checkVersionSeconds); ulong block_height = 0; byte[] block_checksum = null; string headers_path; if (IxianHandler.isTestNet) { headers_path = Path.Combine(Config.spixiUserFolder, "testnet-headers"); } else { headers_path = Path.Combine(Config.spixiUserFolder, "headers"); if (generatedNewWallet || !walletStorage.walletExists()) { generatedNewWallet = false; block_height = CoreConfig.bakedBlockHeight; block_checksum = CoreConfig.bakedBlockChecksum; } else { block_height = Config.bakedRecoveryBlockHeight; block_checksum = Config.bakedRecoveryBlockChecksum; } } // Start TIV tiv.start(headers_path, block_height, block_checksum); // Generate presence list PresenceList.init(IxianHandler.publicIP, 0, 'C'); // Start the network queue NetworkQueue.start(); // Prepare the stream processor StreamProcessor.initialize(Config.spixiUserFolder); // Start the keepalive thread PresenceList.startKeepAlive(); // Start the transfer manager TransferManager.start(); customAppManager.start(); startCounter++; if (mainLoopThread != null) { mainLoopThread.Abort(); mainLoopThread = null; } mainLoopThread = new Thread(mainLoop); mainLoopThread.Name = "Main_Loop_Thread"; mainLoopThread.Start(); // Init push service string tag = Base58Check.Base58CheckEncoding.EncodePlain(IxianHandler.getWalletStorage().getPrimaryAddress()); var push_service = DependencyService.Get <IPushService>(); push_service.setTag(tag); push_service.initialize(); push_service.clearNotifications(); Logging.info("Node started"); }
// Start the node public void start(bool verboseConsoleOutput) { char node_type = 'M'; // TODO TODO TODO TODO change this to 'W' or 'C' after the upgrade if (Config.disableMiner) { node_type = 'M'; } // Check if we're in worker-only mode if (Config.workerOnly) { // Enable miner Config.disableMiner = false; node_type = 'W'; CoreConfig.simultaneousConnectedNeighbors = 4; } // Generate presence list PresenceList.init(IxianHandler.publicIP, Config.serverPort, node_type); // Initialize storage Storage.prepareStorage(); ActivityStorage.prepareStorage(); // Initialize the block chain blockChain = new BlockChain(); //runDiffTests(); //return; // Create the block processor and sync blockProcessor = new BlockProcessor(); blockSync = new BlockSync(); if (Config.devInsertFromJson) { Console.WriteLine("Inserting from JSON"); devInsertFromJson(); Program.noStart = true; return; } if (Config.apiBinds.Count == 0) { Config.apiBinds.Add("http://localhost:" + Config.apiPort + "/"); } // Start the HTTP JSON API server apiServer = new APIServer(Config.apiBinds, Config.apiUsers, Config.apiAllowedIps); if (IXICore.Platform.onMono() == false && !Config.disableWebStart) { System.Diagnostics.Process.Start(Config.apiBinds[0]); } miner = new Miner(); // Start the network queue NetworkQueue.start(); // prepare stats screen ConsoleHelpers.verboseConsoleOutput = verboseConsoleOutput; Logging.consoleOutput = verboseConsoleOutput; Logging.flush(); if (ConsoleHelpers.verboseConsoleOutput == false) { statsConsoleScreen.clearScreen(); } // Distribute genesis funds IxiNumber genesisFunds = new IxiNumber(Config.genesisFunds); // Check if this is a genesis node if (genesisFunds > (long)0) { Logging.info(String.Format("Genesis {0} specified. Starting operation.", genesisFunds)); distributeGenesisFunds(genesisFunds); genesisNode = true; blockProcessor.resumeOperation(); serverStarted = true; if (!isMasterNode()) { Logging.info("Network server is not enabled in modes other than master node."); } else { NetworkServer.beginNetworkOperations(); } } else { if (File.Exists(Config.genesisFile)) { Block genesis = new Block(Crypto.stringToHash(File.ReadAllText(Config.genesisFile))); blockChain.setGenesisBlock(genesis); } ulong lastLocalBlockNum = Meta.Storage.getLastBlockNum(); if (lastLocalBlockNum > 6) { lastLocalBlockNum = lastLocalBlockNum - 6; } if (Config.lastGoodBlock > 0 && Config.lastGoodBlock < lastLocalBlockNum) { lastLocalBlockNum = Config.lastGoodBlock; } if (lastLocalBlockNum > 0) { Block b = blockChain.getBlock(lastLocalBlockNum, true); if (b != null) { ConsensusConfig.minRedactedWindowSize = ConsensusConfig.getRedactedWindowSize(b.version); ConsensusConfig.redactedWindowSize = ConsensusConfig.getRedactedWindowSize(b.version); } } if (Config.recoverFromFile) { Block b = Meta.Storage.getBlock(lastLocalBlockNum); blockSync.onHelloDataReceived(b.blockNum, b.blockChecksum, b.version, b.walletStateChecksum, b.getSignatureCount(), lastLocalBlockNum); } else { ulong blockNum = WalletStateStorage.restoreWalletState(lastLocalBlockNum); if (blockNum > 0) { Block b = blockChain.getBlock(blockNum, true); if (b != null) { blockSync.onHelloDataReceived(blockNum, b.blockChecksum, b.version, b.walletStateChecksum, b.getSignatureCount(), lastLocalBlockNum); } else { walletState.clear(); } } else { blockSync.lastBlockToReadFromStorage = lastLocalBlockNum; } // Start the server for ping purposes serverStarted = true; if (!isMasterNode()) { Logging.info("Network server is not enabled in modes other than master node."); } else { NetworkServer.beginNetworkOperations(); } // Start the network client manager NetworkClientManager.start(); } } PresenceList.startKeepAlive(); TLC = new ThreadLiveCheck(); // Start the maintenance thread maintenanceThread = new Thread(performMaintenance); maintenanceThread.Name = "Node_Maintenance_Thread"; maintenanceThread.Start(); }
public void start(bool verboseConsoleOutput) { UpdateVerify.start(); // Generate presence list PresenceList.init(IxianHandler.publicIP, Config.serverPort, 'C'); // Start the network queue NetworkQueue.start(); ActivityStorage.prepareStorage(); if (Config.apiBinds.Count == 0) { Config.apiBinds.Add("http://localhost:" + Config.apiPort + "/"); } // Start the HTTP JSON API server apiServer = new APIServer(Config.apiBinds, Config.apiUsers, Config.apiAllowedIps); if (IXICore.Platform.onMono() == false && !Config.disableWebStart) { System.Diagnostics.Process.Start(Config.apiBinds[0]); } // Prepare stats screen ConsoleHelpers.verboseConsoleOutput = verboseConsoleOutput; Logging.consoleOutput = verboseConsoleOutput; Logging.flush(); if (ConsoleHelpers.verboseConsoleOutput == false) { statsConsoleScreen.clearScreen(); } // Start the node stream server NetworkServer.beginNetworkOperations(); // Start the network client manager NetworkClientManager.start(2); // Start the keepalive thread PresenceList.startKeepAlive(); // Start TIV string headers_path = ""; if (IxianHandler.isTestNet) { headers_path = Path.Combine(Config.dataDirectory, "testnet-headers"); } else { headers_path = Path.Combine(Config.dataDirectory, "headers"); } if (generatedNewWallet || !File.Exists(Path.Combine(Config.dataDirectory, Config.walletFile))) { generatedNewWallet = false; tiv.start(headers_path); } else { tiv.start(headers_path, 0, null); } // Start the maintenance thread maintenanceThread = new Thread(performMaintenance); maintenanceThread.Start(); pushNotifications = new PushNotifications(Config.pushServiceUrl); pushNotifications.start(); }
public void start(bool verboseConsoleOutput) { // Generate presence list PresenceList.init(IxianHandler.publicIP, Config.serverPort, 'R'); // Start the network queue NetworkQueue.start(); ActivityStorage.prepareStorage(); if (Config.apiBinds.Count == 0) { Config.apiBinds.Add("http://localhost:" + Config.apiPort + "/"); } // Start the HTTP JSON API server apiServer = new APIServer(Config.apiBinds, Config.apiUsers, Config.apiAllowedIps); if (IXICore.Platform.onMono() == false && !Config.disableWebStart) { System.Diagnostics.Process.Start(Config.apiBinds[0]); } // Prepare stats screen ConsoleHelpers.verboseConsoleOutput = verboseConsoleOutput; Logging.consoleOutput = verboseConsoleOutput; Logging.flush(); if (ConsoleHelpers.verboseConsoleOutput == false) { statsConsoleScreen.clearScreen(); } // Check for test client mode if (Config.isTestClient) { TestClientNode.start(); return; } // Start the node stream server NetworkServer.beginNetworkOperations(); // Start the network client manager NetworkClientManager.start(2); // Start the keepalive thread PresenceList.startKeepAlive(); // Start TIV if (generatedNewWallet || !walletStorage.walletExists()) { generatedNewWallet = false; tiv.start(""); } else { tiv.start("", 0, null); } // Start the maintenance thread maintenanceThread = new Thread(performMaintenance); maintenanceThread.Start(); }