public void InitializeRootSeed(bool aForceSeed = false)
        {
            UserStatus lUserStatus = FWalletPandoraServer.GetUserStatus();
            DateTime   lLockDate   = new DateTime(2019, 4, 8, 23, 59, 59);
            string     lEmail      = FWalletPandoraServer.Email;
            string     lUsername   = FWalletPandoraServer.Username;

            if (FSeed == null || aForceSeed)
            {
                FSeed = FKeyManager.GetSecretRootSeed(lEmail.ToLower(), lUsername.ToLower());
                if (lUserStatus.StatusDate <= lLockDate)
                {
                    string lStatusMessage = lUserStatus.ExtendedInfo;

                    if (lUserStatus.ExtendedInfo.Contains("Actual Case is:"))
                    {
                        int      lStart     = lStatusMessage.IndexOf(":", StringComparison.Ordinal) + 1;
                        string[] lSubstring = lStatusMessage.Substring(lStart, lStatusMessage.Length - lStart).Split(new string[] { "***" }, StringSplitOptions.RemoveEmptyEntries);
                        lEmail    = lSubstring[0].Trim();
                        lUsername = lSubstring[1].Trim();
                        FSeed     = FKeyManager.GetSecretRootSeed(lEmail, lUsername);
                    }
                    else
                    {
                        FSeed = FKeyManager.GetSecretRootSeed(lEmail, lUsername);
                        CurrencyItem            lCurrency = FWalletPandoraServer.GetCurrency(1);
                        IClientCurrencyAdvocacy lAdvocacy = CurrencyControl.GetCurrencyControl().GetClientCurrencyAdvocacy((uint)lCurrency.Id, lCurrency.ChainParamaters);
                        lAdvocacy.RootSeed = FSeed;
                        string lComparationAddress = lAdvocacy.GetAddress(1);
                        string lAddress            = GetCoinAddress(1);

                        if (lComparationAddress != lAddress)
                        {
                            string lMessage = string.Format("Please contact support at [email protected] about Ontime Issue #1344");
                            throw new Exception(lMessage);
                        }
                        FWalletPandoraServer.MarkOldUser(lEmail, lUsername);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void PandoraServerTest()
        {
            TestServer = new PandorasServer(Path.Combine(Directory.GetCurrentDirectory(), "DBTEST"), "localhost", 20159);

            Assert.IsTrue(TestServer.Logon("*****@*****.**", "quality", "quality"));

            TestServer.OnTransactions += NewTransactionTestHandler;

            var TestUserStatus = (TestServer.GetUserStatus());

            Assert.IsTrue(TestUserStatus.Active && TestUserStatus.ExtendedInfo == "Quality Testing User");

            CurrencyItem[] Currencies = TestServer.GetCurrencyList();

            Assert.IsTrue(Currencies.Count() > 0 && Currencies[0].Name == "Bitcoin");

            CurrencyStatusItem Result2 = TestServer.GetCurrencyStatus(1);

            Assert.IsTrue(Result2.Status == CurrencyStatus.Active && Result2.ExtendedInfo == "The coin is working fine with 3 servers running with consensus.");

            CurrencyAccount[] Accounts = TestServer.MonitoredAccounts.GetById(1);

            Assert.AreEqual(Accounts[0].Address, "mk4DoTmTB8PnNgPyvzozTeNGxC1fduJqb5");

            TestServer.StartTxUpdatingTask();

            while (!Records.Any())
            {
                Records = TestServer.GetTransactions(1);
                System.Threading.Thread.Sleep(1000);
            }

            TransactionRecord Record = Records.FirstOrDefault();

            Assert.IsTrue(Record.TxId == "30c8e2f7f5cf8b00f8b8bff127a8ceb726e30ab354dda361199fc435c22275b9");

            Assert.IsTrue(Record.Block == 1355565);

            Assert.IsTrue(Record.Outputs.Count() == 2);

            var Outputs = Record.Outputs.ToList();

            Assert.IsTrue(Outputs.Exists(x => x.Address == "mk4DoTmTB8PnNgPyvzozTeNGxC1fduJqb5" && x.Amount == 150000000));
            Assert.IsTrue(Outputs.Exists(x => x.Address == "2MwqZdwPUrmBACjacg8uwEZ8rVoCUX7GD2h" && x.Amount == 111418554));

            var Transaction = new CurrencyTransaction();

            Transaction.AddInput(150000000, "mk4DoTmTB8PnNgPyvzozTeNGxC1fduJqb5", 10151);
            Transaction.AddOutput(100000000, "mtCFoNLWbgHnB1SG7R7VqiDizGUP8K2uae");
            Transaction.AddOutput(50000000, "mk4DoTmTB8PnNgPyvzozTeNGxC1fduJqb5");

            Transaction.TxFee = 250000;

            Transaction.CurrencyId = 1;

            //var Response = TestServer.CreateTransaction(1, Transaction);

            //Assert.IsTrue(Response == "0100000001b97522c235c49f1961a3dd54b30ae326b7cea827f1bfb8f8008bcff5f7e2c830010000001976a91431ca57b301db0088e2d5912cff743210364b126c88acffffffff0200e1f505000000001976a9148b10583ecc2a455ab21342b3b34943ec711e694888ac80f0fa02000000001976a91431ca57b301db0088e2d5912cff743210364b126c88ac00000000");

            TestServer.Logoff();
        }