Ejemplo n.º 1
0
        private static void ExecuteP2PNetworkRunningMenu(int number)
        {
            if (number < 0 || number > 4)
            {
                MenuHelper.DisplayError("Enter a number between [1-4]");
                ExecuteFullNodeMenu();
                return;
            }

            switch (number)
            {
            case 1:
                Console.WriteLine($"Number of active nodes {_nodeLauncher.GetActivePeers().Count}");
                break;

            case 2:
                var peers = _nodeLauncher.GetActivePeers();
                var ips   = peers.Select(p => (new IPAddress(p.GetCurrentIpAddress().Ipv6)).MapToIPv4().ToString());
                foreach (var ip in ips)
                {
                    Console.WriteLine(ip);
                }
                break;

            case 3:
                _nodeLauncher.RefreshMemPool();
                _nodeLauncher.RefreshBlockChain();
                break;

            case 4:

                break;

            case 5:
                _nodeLauncher.GetP2PNode().Stop();
                _nodeLauncher.GetP2PNetwork().Stop();
                break;
            }

            ExecuteFullNodeMenu();
        }