Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        static public void start()
        {
            if (running)
            {
                return;
            }
            Logging.info("Starting node");

            running = true;

            UpdateVerify.init(Config.checkVersionUrl, Config.checkVersionSeconds);
            UpdateVerify.start();

            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 || !checkForExistingWallet())
                {
                    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");
        }