Beispiel #1
0
        // Perform basic initialization of node
        public void init()
        {
            running = true;

            // First create the data folder if it does not already exist
            checkDataFolder();

            renameStorageFiles(); // this function will be here temporarily for the next few version, then it will be removed to keep a cleaner code base

            // debug
            if (Config.networkDumpFile != "")
            {
                NetDump.Instance.start(Config.networkDumpFile);
            }

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

            NetworkUtils.configureNetwork(Config.externalIp, Config.serverPort);

            // Load or Generate the wallet
            if (!initWallet())
            {
                running = false;
                DLTNode.Program.noStart = true;
                return;
            }

            // Setup the stats console
            statsConsoleScreen = new StatsConsoleScreen();

            // Initialize the wallet state
            walletState = new WalletState();
        }
Beispiel #2
0
        // Perform basic initialization of node
        private void init()
        {
            running = true;

            CoreConfig.maximumServerMasterNodes = Config.maximumStreamClients;
            CoreConfig.maximumServerClients     = Config.maximumStreamClients;

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

            // Network configuration
            NetworkUtils.configureNetwork(Config.externalIp, Config.serverPort);

            // Load or Generate the wallet
            if (!initWallet())
            {
                running            = false;
                S2.Program.noStart = true;
                return;
            }

            // Setup the stats console
            statsConsoleScreen = new StatsConsoleScreen();

            PeerStorage.init("");

            // Init TIV
            tiv = new TransactionInclusion();
        }
Beispiel #3
0
        // Perform basic initialization of node
        public void init()
        {
            running = true;

            // First create the data folder if it does not already exist
            checkDataFolder();

            renameStorageFiles(); // this function will be here temporarily for the next few version, then it will be removed to keep a cleaner code base

            // debug
            if (Config.networkDumpFile != "")
            {
                NetDump.Instance.start(Config.networkDumpFile);
            }

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

            // Initialize storage
            if (storage is null)
            {
                storage = IStorage.create(Config.blockStorageProvider);
            }
            if (!storage.prepareStorage())
            {
                Logging.error("Error while preparing block storage! Aborting.");
                Program.noStart = true;
                return;
            }

            NetworkUtils.configureNetwork(Config.externalIp, Config.serverPort);

            // Load or Generate the wallet
            if (!initWallet())
            {
                storage.stopStorage();
                running = false;
                DLTNode.Program.noStart = true;
                return;
            }

            // Setup the stats console
            statsConsoleScreen = new StatsConsoleScreen();

            // Initialize the wallet state
            walletState = new WalletState();

            inventoryCache = new InventoryCacheDLT();

            PeerStorage.init("");
        }
Beispiel #4
0
 private string checkForUpdate()
 {
     UpdateVerify.checkVersion();
     if (UpdateVerify.inProgress)
     {
         return("(checking)");
     }
     if (UpdateVerify.ready)
     {
         if (UpdateVerify.error)
         {
             return("(error)");
         }
         return(UpdateVerify.serverVersion);
     }
     return("(not checked)");
 }
Beispiel #5
0
        static public void stop()
        {
            Program.noStart            = true;
            IxianHandler.forceShutdown = true;

            UpdateVerify.stop();

            Node.pushNotifications.stop();

            // Stop TIV
            tiv.stop();

            // Stop the keepalive thread
            PresenceList.stopKeepAlive();

            // Stop the API server
            if (apiServer != null)
            {
                apiServer.stop();
                apiServer = null;
            }

            if (maintenanceThread != null)
            {
                maintenanceThread.Abort();
                maintenanceThread = null;
            }

            ActivityStorage.stopStorage();

            // Stop the network queue
            NetworkQueue.stop();

            // Stop all network clients
            NetworkClientManager.stop();

            // Stop the network server
            NetworkServer.stopNetworkOperations();

            // Stop the console stats screen
            // Console screen has a thread running even if we are in verbose mode
            statsConsoleScreen.stop();
        }
Beispiel #6
0
        static public void stop()
        {
            if (!running)
            {
                Logging.stop();
                IxianHandler.status = NodeStatus.stopped;
                return;
            }

            Logging.info("Stopping node...");
            running = false;

            // Stop the stream processor
            StreamProcessor.uninitialize();

            localStorage.stop();

            customAppManager.stop();

            // Stop TIV
            tiv.stop();

            // Stop the transfer manager
            TransferManager.stop();

            // Stop the keepalive thread
            PresenceList.stopKeepAlive();

            // Stop the network queue
            NetworkQueue.stop();

            NetworkClientManager.stop();
            StreamClientManager.stop();

            UpdateVerify.stop();

            IxianHandler.status = NodeStatus.stopped;

            Logging.info("Node stopped");

            Logging.stop();
        }
Beispiel #7
0
 private string checkUpdate()
 {
     UpdateVerify.checkVersion();
     if (UpdateVerify.inProgress)
     {
         return("");
     }
     if (UpdateVerify.ready)
     {
         if (UpdateVerify.error)
         {
             return("");
         }
         if (UpdateVerify.serverVersion.CompareTo(Config.version) > 0)
         {
             return(UpdateVerify.serverVersion);
         }
     }
     return("");
 }
Beispiel #8
0
        // Perform basic initialization of node
        private void init()
        {
            running = true;

            CoreConfig.maximumServerMasterNodes = Config.maximumStreamClients;
            CoreConfig.maximumServerClients     = Config.maximumStreamClients;

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

            // Network configuration
            NetworkUtils.configureNetwork(Config.externalIp, Config.serverPort);

            // Load or Generate the wallet
            if (!initWallet())
            {
                running = false;
                SpixiBot.Program.noStart = true;
                return;
            }

            // Setup the stats console
            statsConsoleScreen = new StatsConsoleScreen();

            PeerStorage.init("");

            // Init TIV
            tiv = new TransactionInclusion();

            string avatarPath = Path.Combine(Config.dataDirectory, "Avatars");

            users = new BotUsers(Path.Combine(Config.dataDirectory, "contacts.dat"), avatarPath, false);
            users.loadContactsFromFile();

            groups = new BotGroups(Path.Combine(Config.dataDirectory, "groups.dat"));
            groups.loadGroupsFromFile();

            channels = new BotChannels(Path.Combine(Config.dataDirectory, "channels.dat"));
            channels.loadChannelsFromFile();

            StreamProcessor.init(Path.Combine(Config.dataDirectory, "Messages"));
        }
Beispiel #9
0
        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");
        }
Beispiel #10
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();
        }