Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions dash-spv/src/client/filter_sync.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
//! Filter synchronization and management for the Dash SPV client.

#![allow(deprecated)]

use std::sync::Arc;
use tokio::sync::RwLock;

use crate::error::{Result, SpvError};
use crate::network::NetworkManager;
use crate::storage::StorageManager;
use crate::sync::SyncManager;
use crate::sync::sequential::SequentialSyncManager;
use crate::types::SpvStats;
use crate::types::{FilterMatch, WatchItem};

/// Filter synchronization manager for coordinating filter downloads and checking.
pub struct FilterSyncCoordinator<'a, S: StorageManager, N: NetworkManager> {
sync_manager: &'a mut SyncManager<S, N>,
sync_manager: &'a mut SequentialSyncManager<S, N>,
storage: &'a mut S,
network: &'a mut N,
watch_items: &'a Arc<RwLock<std::collections::HashSet<WatchItem>>>,
Expand All @@ -27,7 +25,7 @@ impl<'a, S: StorageManager + Send + Sync + 'static, N: NetworkManager + Send + S
{
/// Create a new filter sync coordinator.
pub fn new(
sync_manager: &'a mut SyncManager<S, N>,
sync_manager: &'a mut SequentialSyncManager<S, N>,
storage: &'a mut S,
network: &'a mut N,
watch_items: &'a Arc<RwLock<std::collections::HashSet<WatchItem>>>,
Expand Down Expand Up @@ -165,10 +163,4 @@ impl<'a, S: StorageManager + Send + Sync + 'static, N: NetworkManager + Send + S
let watch_items = self.watch_items.read().await;
watch_items.iter().cloned().collect()
}

/// Helper method to find height for a block hash.
async fn find_height_for_block_hash(&self, block_hash: dashcore::BlockHash) -> Option<u32> {
// Use the efficient reverse index
self.storage.get_header_height_by_hash(&block_hash).await.ok().flatten()
}
}
4 changes: 0 additions & 4 deletions dash-spv/src/client/message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::error::{Result, SpvError};
use crate::mempool_filter::MempoolFilter;
use crate::network::NetworkManager;
use crate::storage::StorageManager;
use crate::sync::filters::FilterNotificationSender;
use crate::sync::sequential::SequentialSyncManager;
use crate::types::{MempoolState, SpvEvent, SpvStats};

Expand All @@ -19,7 +18,6 @@ pub struct MessageHandler<'a, S: StorageManager, N: NetworkManager> {
network: &'a mut N,
config: &'a ClientConfig,
stats: &'a Arc<RwLock<SpvStats>>,
filter_processor: &'a Option<FilterNotificationSender>,
block_processor_tx: &'a tokio::sync::mpsc::UnboundedSender<crate::client::BlockProcessingTask>,
mempool_filter: &'a Option<Arc<MempoolFilter>>,
mempool_state: &'a Arc<RwLock<MempoolState>>,
Expand All @@ -36,7 +34,6 @@ impl<'a, S: StorageManager + Send + Sync + 'static, N: NetworkManager + Send + S
network: &'a mut N,
config: &'a ClientConfig,
stats: &'a Arc<RwLock<SpvStats>>,
filter_processor: &'a Option<FilterNotificationSender>,
block_processor_tx: &'a tokio::sync::mpsc::UnboundedSender<
crate::client::BlockProcessingTask,
>,
Expand All @@ -50,7 +47,6 @@ impl<'a, S: StorageManager + Send + Sync + 'static, N: NetworkManager + Send + S
network,
config,
stats,
filter_processor,
block_processor_tx,
mempool_filter,
mempool_state,
Expand Down
Loading
Loading