Esempio n. 1
0
        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);
        }
Esempio n. 2
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");
        }