示例#1
0
        static void Run()
        {
            Thread clientThread = null;
            Thread minerThread  = null;
            Thread listenThread = null;

            // If this node acts as an active node, create an identity.
            if (_minerFlag || _clientFlag)
            {
                _identity = new Identity();
                _account  = Account.AccountFactory(
                    _identity.Address, UserAccount.TYPE);

                if (_minerFlag)
                {
                    _miner      = new Miner((INodeMiner)_node, _identity, Announce);
                    minerThread = new Thread(_miner.Run);
                    minerThread.Start();
                }
                if (_clientFlag)
                {
                    _client = new Client(
                        (INodeClient)_node, _identity, Announce);
                    clientThread = new Thread(_client.Run);
                    clientThread.Start();
                }
            }

            listenThread = new Thread(() => Listen(_address));
            listenThread.Start();
        }