private async void IndexDownloader_NewFilterAsync(object sender, FilterModel filterModel) { try { using (await HandleFiltersLock.LockAsync()) { if (KeyManager.GetBestHeight() < filterModel.Header.Height) { await ProcessFilterModelAsync(filterModel, CancellationToken.None); } } NewFilterProcessed?.Invoke(this, filterModel); do { await Task.Delay(100); if (Synchronizer is null || BitcoinStore?.SmartHeaderChain is null) { return; } // Make sure fully synced and this filter is the lastest filter. if (BitcoinStore.SmartHeaderChain.HashesLeft != 0 || BitcoinStore.SmartHeaderChain.TipHash != filterModel.Header.BlockHash) { return; } } while (Synchronizer.AreRequestsBlocked()); // If requests are blocked, delay mempool cleanup, because coinjoin answers are always priority. await BitcoinStore.MempoolService?.TryPerformMempoolCleanupAsync(Synchronizer?.WasabiClient?.TorClient?.DestinationUriAction, Synchronizer?.WasabiClient?.TorClient?.TorSocks5EndPoint); } catch (Exception ex) { Logger.LogWarning(ex); } }
private async void IndexDownloader_NewFilterAsync(object sender, FilterModel filterModel) { using (HandleFiltersLock.Lock()) using (WalletBlocksLock.Lock()) { if (filterModel.Filter != null && !WalletBlocks.ContainsValue(filterModel.BlockHash)) { await ProcessFilterModelAsync(filterModel, CancellationToken.None); } } NewFilterProcessed?.Invoke(this, filterModel); }
private void OnNewFilterProcessed(FilterModel filter) => NewFilterProcessed?.Invoke(this, filter);