Exemple #1
0
        private string GetChainFile()
        {
            string walletFolderPath = WalletFileTools.GetWalletFolder(_wallet.Id);
            var    chainFilePath    = Path.Combine(walletFolderPath, "chain.dat");

            return(chainFilePath);
        }
Exemple #2
0
        private string GetAddrmanFile()
        {
            string walletFolderPath = WalletFileTools.GetWalletFolder(_wallet.Id);
            var    addrFilePath     = Path.Combine(walletFolderPath, "addrman.dat");

            return(addrFilePath);
        }
        public void GetWalletFolder()
        {
            string actualFolderPath   = WalletFileTools.GetWalletFolder(_wallet.Id);
            string expectedFolderPath = Path.Combine(App.WalletsDir, _wallet.Id);

            Assert.AreEqual(expectedFolderPath, actualFolderPath);
        }
Exemple #4
0
        private string GetTrackerFile()
        {
            string walletFolderPath = WalletFileTools.GetWalletFolder(_wallet.Id);
            var    trackerFilePath  = Path.Combine(walletFolderPath, "tracker.dat");

            return(trackerFilePath);
        }
        public void CleanWalletFolder()
        {
            string walletFolder = WalletFileTools.GetWalletFolder(_wallet.Id);

            if (Directory.Exists(walletFolder))
            {
                Directory.Delete(walletFolder, true);
            }
            WalletFileTools.CreateWalletFolder(_mock.Object.Id);
        }
        private void CreateWrongChain()
        {
            string          walletFolderPath = WalletFileTools.GetWalletFolder(_wallet.Id);
            var             chainFilePath    = Path.Combine(walletFolderPath, "chain.dat");
            var             wrongNetwork     = Network.Main; // _wallet.NetworkChoice = Network.Testnet
            ConcurrentChain mainChain        = new ConcurrentChain(wrongNetwork);

            using (var fs = File.Open(chainFilePath, FileMode.Create))
            {
                mainChain.WriteTo(fs);
            }
        }
        public void BadAddressManager()
        {
            _wconnect.Start();
            _wconnect.Stop();

            string walletFolderPath = WalletFileTools.GetWalletFolder(_wallet.Id);
            var    addrmanFilePath  = Path.Combine(walletFolderPath, "addrman.dat");

            using (var fs = File.Open(addrmanFilePath, FileMode.Create))
            {
                StreamWriter writer = new StreamWriter(fs);
                writer.WriteLine("BAD_ADDRESS_MANAGER");
                writer.Dispose();
            }

            Assert.Throws <OverflowException>(() => _wconnect.Start());
        }
        public void BadTrackerFile()
        {
            _wconnect.Start();
            _wconnect.Stop();

            string walletFolderPath = WalletFileTools.GetWalletFolder(_wallet.Id);
            var    trackerFilePath  = Path.Combine(walletFolderPath, "tracker.dat");

            using (var fs = File.Open(trackerFilePath, FileMode.Create))
            {
                StreamWriter writer = new StreamWriter(fs);
                writer.WriteLine("BAD_TRACKER");
                writer.Dispose();
            }

            Assert.Throws <JsonReaderException>(() => _wconnect.Start());
        }
 public void Clear()
 {
     FileSecurity.LiftFileDefense(_path);
     FileSecurity.LiftFileDefense(_recoverypath);
     Directory.Delete(WalletFileTools.GetWalletFolder(_wallet.Id), true);
 }