Example #1
0
 private void OnStartConsensusCommand()
 {
     if (NoWallet())
     {
         return;
     }
     ShowPrompt = false;
     NeoSystem.StartConsensus(CurrentWallet);
 }
Example #2
0
 private bool OnStartConsensusCommand(string[] args)
 {
     if (NoWallet())
     {
         return(true);
     }
     _system.StartConsensus(Program.Wallet);
     return(true);
 }
        public static Task RunAsync(Store store, ExpressConsensusNode node, TextWriter writer, CancellationToken cancellationToken)
        {
            var tcs = new TaskCompletionSource <bool>();

            Task.Run(() =>
            {
                try
                {
                    var wallet = DevWallet.FromExpressWallet(node.Wallet);
                    using (var system = new NeoSystem(store))
                    {
                        var logPlugin = new LogPlugin(writer);
                        var rpcPlugin = new ExpressNodeRpcPlugin(store);

                        system.StartNode(node.TcpPort, node.WebSocketPort);

                        system.StartConsensus(wallet);
                        system.StartRpc(IPAddress.Loopback, node.RpcPort, wallet);

                        {
                            using var snapshot = Blockchain.Singleton.GetSnapshot();
                            var validators     = snapshot.GetValidators();

                            ;
                        }

                        cancellationToken.WaitHandle.WaitOne();
                    }
                }
                catch (Exception ex)
                {
                    tcs.SetException(ex);
                }
                finally
                {
                    if (store is IDisposable disposable)
                    {
                        disposable.Dispose();
                    }
                    tcs.TrySetResult(true);
                }
            });

            return(tcs.Task);
        }