Beispiel #1
0
        private async void Synchronizer_ResponseArrivedAsync(object sender, SynchronizeResponse response)
        {
            try
            {
                using (await ProcessLock.LockAsync())
                {
                    var unconfirmedCoinJoinHashes = response.UnconfirmedCoinJoins;
                    if (!unconfirmedCoinJoinHashes.Any())
                    {
                        return;
                    }

                    var txsNotKnownByAWallet = WalletManager.FilterUnknownCoinjoins(unconfirmedCoinJoinHashes);

                    using var client = new WasabiClient(Synchronizer.WasabiClient.TorClient.DestinationUriAction, Synchronizer.WasabiClient.TorClient.TorSocks5EndPoint);

                    var unconfirmedCoinJoins = await client.GetTransactionsAsync(Synchronizer.Network, txsNotKnownByAWallet, CancellationToken.None).ConfigureAwait(false);

                    foreach (var tx in unconfirmedCoinJoins.Select(x => new SmartTransaction(x, Height.Mempool)))
                    {
                        if (RpcClient is null ||
                            await TryBroadcastTransactionWithRpcAsync(tx).ConfigureAwait(false) ||
                            (await RpcClient.TestAsync().ConfigureAwait(false)) is { })                                // If the test throws exception then I believe it, because RPC is down and the backend is the god.
                        {
                            WalletManager.ProcessCoinJoin(tx);
                        }
                    }