Пример #1
0
 //TODO: 目前没有想到其它安全的方法来保存密码
 //所以只能暂时手动输入,但如此一来就不能以服务的方式启动了
 //未来再想想其它办法,比如采用智能卡之类的
 private async void OnOpenWalletCommand(string path)
 {
     SecureString password = ReadSecureString("password");
     if (password.Length == 0)
     {
         Console.WriteLine("cancelled");
         return;
     }
     try
     {
         wallet = MinerWallet.Open(path, password);
     }
     catch
     {
         Console.WriteLine($"failed to open file \"{path}\"");
         return;
     }
     await localnode.WaitForNodesAsync();
     context = new BlockConsensusContext(wallet.PublicKey);
     await SendConsensusRequestAsync();
 }
Пример #2
0
        //TODO: 目前没有想到其它安全的方法来保存密码
        //所以只能暂时手动输入,但如此一来就不能以服务的方式启动了
        //未来再想想其它办法,比如采用智能卡之类的
        private async void OnOpenWalletCommand(string path)
        {
            SecureString password = ReadSecureString("password");

            if (password.Length == 0)
            {
                Console.WriteLine("cancelled");
                return;
            }
            try
            {
                wallet = MinerWallet.Open(path, password);
            }
            catch
            {
                Console.WriteLine($"failed to open file \"{path}\"");
                return;
            }
            //TODO: 等待连接到其它节点
            context = new BlockConsensusContext(wallet.PublicKey);
            await SendConsensusRequestAsync();
        }