Beispiel #1
0
 public UpdateChecker(TimeSpan period, WasabiSynchronizer synchronizer) : base(period)
 {
     Synchronizer = synchronizer;
     UpdateStatus = new UpdateStatus(true, true, new Version(), 0, new Version());
     WasabiClient = Synchronizer.HttpClientFactory.SharedWasabiClient;
     Synchronizer.PropertyChanged += Synchronizer_PropertyChanged;
 }
Beispiel #2
0
        public CcjClient(
            WasabiSynchronizer synchronizer,
            Network network,
            KeyManager keyManager,
            Uri ccjHostUri,
            IPEndPoint torSocks5EndPoint = null)
        {
            Network                      = Guard.NotNull(nameof(network), network);
            KeyManager                   = Guard.NotNull(nameof(keyManager), keyManager);
            CcjHostUri                   = Guard.NotNull(nameof(ccjHostUri), ccjHostUri);
            Synchronizer                 = Guard.NotNull(nameof(synchronizer), synchronizer);
            TorSocks5EndPoint            = torSocks5EndPoint;
            CoordinatorFeepercentToCheck = null;

            ExposedLinks = new ConcurrentDictionary <TxoRef, IEnumerable <HdPubKeyBlindedPair> >();
            _running     = 0;
            Cancel       = new CancellationTokenSource();
            _frequentStatusProcessingIfNotMixing = 0;
            State                    = new CcjClientState();
            MixLock                  = new AsyncLock();
            _statusProcessing        = 0;
            DelayedRoundRegistration = null;

            Synchronizer.ResponseArrived += Synchronizer_ResponseArrivedAsync;
        }
        private void Create(WasabiSynchronizer synchronizer, Network network, KeyManager keyManager, Func <Uri> ccjHostUriAction, IPEndPoint torSocks5EndPoint)
        {
            Network                      = Guard.NotNull(nameof(network), network);
            KeyManager                   = Guard.NotNull(nameof(keyManager), keyManager);
            CcjHostUriAction             = Guard.NotNull(nameof(ccjHostUriAction), ccjHostUriAction);
            Synchronizer                 = Guard.NotNull(nameof(synchronizer), synchronizer);
            TorSocks5EndPoint            = torSocks5EndPoint;
            CoordinatorFeepercentToCheck = null;

            ExposedLinks = new ConcurrentDictionary <TxoRef, IEnumerable <HdPubKeyBlindedPair> >();
            _running     = 0;
            Cancel       = new CancellationTokenSource();
            _frequentStatusProcessingIfNotMixing = 0;
            State                    = new CcjClientState();
            MixLock                  = new AsyncLock();
            _statusProcessing        = 0;
            DelayedRoundRegistration = null;

            Synchronizer.ResponseArrived += Synchronizer_ResponseArrivedAsync;

            var lastResponse = Synchronizer.LastResponse;

            if (lastResponse != null)
            {
                _ = TryProcessStatusAsync(Synchronizer.LastResponse.CcjRoundStates);
            }
        }
Beispiel #4
0
 public UpdateChecker(TimeSpan period, WasabiSynchronizer synchronizer) : base(period)
 {
     Synchronizer = synchronizer;
     UpdateStatus = new UpdateStatus(true, true, new Version(), 0);
     WasabiClient = Synchronizer.WasabiClientFactory.NewBackendClient();
     Synchronizer.PropertyChanged += Synchronizer_PropertyChanged;
 }
Beispiel #5
0
        public CcjClient(WasabiSynchronizer synchronizer, Network network, BlindingRsaPubKey coordinatorPubKey, KeyManager keyManager, Uri ccjHostUri, IPEndPoint torSocks5EndPoint = null)
        {
            AccessCache                  = new ConcurrentDictionary <HdPubKey, DateTimeOffset>();
            Network                      = Guard.NotNull(nameof(network), network);
            CoordinatorPubKey            = Guard.NotNull(nameof(coordinatorPubKey), coordinatorPubKey);
            KeyManager                   = Guard.NotNull(nameof(keyManager), keyManager);
            CcjHostUri                   = Guard.NotNull(nameof(ccjHostUri), ccjHostUri);
            Synchronizer                 = Guard.NotNull(nameof(synchronizer), synchronizer);
            TorSocks5EndPoint            = torSocks5EndPoint;
            CoordinatorFeepercentToCheck = null;

            _running = 0;
            Cancel   = new CancellationTokenSource();
            _frequentStatusProcessingIfNotMixing = 0;
            State             = new CcjClientState();
            MixLock           = new AsyncLock();
            _statusProcessing = 0;

            CustomChangeAddresses     = new List <BitcoinAddress>();
            CustomActiveAddresses     = new List <BitcoinAddress>();
            CustomChangeAddressesLock = new object();
            CustomActiveAddressesLock = new object();

            Synchronizer.ResponseArrived += Synchronizer_ResponseArrivedAsync;
        }
Beispiel #6
0
        public WalletService(
            BitcoinStore bitcoinStore,
            KeyManager keyManager,
            WasabiSynchronizer syncer,
            CoinJoinClient chaumianClient,
            NodesGroup nodes,
            string workFolderDir,
            ServiceConfiguration serviceConfiguration,
            IFeeProvider feeProvider,
            CoreNode coreNode = null)
        {
            BitcoinStore         = Guard.NotNull(nameof(bitcoinStore), bitcoinStore);
            KeyManager           = Guard.NotNull(nameof(keyManager), keyManager);
            Nodes                = Guard.NotNull(nameof(nodes), nodes);
            Synchronizer         = Guard.NotNull(nameof(syncer), syncer);
            ChaumianClient       = Guard.NotNull(nameof(chaumianClient), chaumianClient);
            ServiceConfiguration = Guard.NotNull(nameof(serviceConfiguration), serviceConfiguration);
            FeeProvider          = Guard.NotNull(nameof(feeProvider), feeProvider);
            CoreNode             = coreNode;

            HandleFiltersLock = new AsyncLock();

            BlocksFolderPath = Path.Combine(workFolderDir, "Blocks", Network.ToString());
            RuntimeParams.SetDataDir(workFolderDir);

            BlockFolderLock = new AsyncLock();

            KeyManager.AssertCleanKeysIndexed();
            KeyManager.AssertLockedInternalKeysIndexed(14);

            TransactionProcessor = new TransactionProcessor(BitcoinStore.TransactionStore, KeyManager, ServiceConfiguration.DustThreshold, ServiceConfiguration.PrivacyLevelStrong);
            Coins = TransactionProcessor.Coins;

            TransactionProcessor.WalletRelevantTransactionProcessed += TransactionProcessor_WalletRelevantTransactionProcessedAsync;

            if (Directory.Exists(BlocksFolderPath))
            {
                if (Synchronizer.Network == Network.RegTest)
                {
                    Directory.Delete(BlocksFolderPath, true);
                    Directory.CreateDirectory(BlocksFolderPath);
                }
            }
            else
            {
                Directory.CreateDirectory(BlocksFolderPath);
            }

            var walletName = "UnnamedWallet";

            if (!string.IsNullOrWhiteSpace(KeyManager.FilePath))
            {
                walletName = Path.GetFileNameWithoutExtension(KeyManager.FilePath);
            }

            BitcoinStore.IndexStore.NewFilter += IndexDownloader_NewFilterAsync;
            BitcoinStore.IndexStore.Reorged   += IndexDownloader_ReorgedAsync;
            BitcoinStore.MempoolService.TransactionReceived += Mempool_TransactionReceived;
        }
Beispiel #7
0
        public UpdateChecker(TimeSpan period, WasabiSynchronizer synchronizer) : base(period)
        {
            Synchronizer = Guard.NotNull(nameof(synchronizer), synchronizer);
            WasabiClient = synchronizer.WasabiClient;
            UpdateStatus = new UpdateStatus(true, true, new Version(), 0);

            Synchronizer.PropertyChanged += Synchronizer_PropertyChanged;
        }
 public CcjClient(
     WasabiSynchronizer synchronizer,
     Network network,
     KeyManager keyManager,
     Uri ccjHostUri,
     IPEndPoint torSocks5EndPoint)
 {
     Create(synchronizer, network, keyManager, () => ccjHostUri, torSocks5EndPoint);
 }
 public CcjClient(
     WasabiSynchronizer synchronizer,
     Network network,
     KeyManager keyManager,
     Func <Uri> ccjHostUriAction,
     IPEndPoint torSocks5EndPoint)
 {
     Create(synchronizer, network, keyManager, ccjHostUriAction, torSocks5EndPoint);
 }
 public static FilterModel GetStartingFilter(Network network) => WasabiSynchronizer.GetStartingFilter(network);