Skip to content

Commit 75e194a

Browse files
committed
refactor: Make flow control syncing default and drop the no flow parts
1 parent 8bf829f commit 75e194a

21 files changed

Lines changed: 34 additions & 2213 deletions

dash-spv/src/client/config.rs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -78,42 +78,9 @@ pub struct ClientConfig {
7878
/// Maximum concurrent filter requests (default: 8).
7979
pub max_concurrent_filter_requests: usize,
8080

81-
/// Enable flow control for filter requests (default: true).
82-
pub enable_filter_flow_control: bool,
83-
8481
/// Delay between filter requests in milliseconds (default: 50).
8582
pub filter_request_delay_ms: u64,
8683

87-
/// Enable automatic CFHeader gap detection and restart
88-
pub enable_cfheader_gap_restart: bool,
89-
90-
/// Interval for checking CFHeader gaps (seconds)
91-
pub cfheader_gap_check_interval_secs: u64,
92-
93-
/// Cooldown between CFHeader restart attempts (seconds)
94-
pub cfheader_gap_restart_cooldown_secs: u64,
95-
96-
/// Maximum CFHeader gap restart attempts
97-
pub max_cfheader_gap_restart_attempts: u32,
98-
99-
/// Enable automatic filter gap detection and restart
100-
pub enable_filter_gap_restart: bool,
101-
102-
/// Interval for checking filter gaps (seconds)
103-
pub filter_gap_check_interval_secs: u64,
104-
105-
/// Minimum filter gap size to trigger restart (blocks)
106-
pub min_filter_gap_size: u32,
107-
108-
/// Cooldown between filter restart attempts (seconds)
109-
pub filter_gap_restart_cooldown_secs: u64,
110-
111-
/// Maximum filter gap restart attempts
112-
pub max_filter_gap_restart_attempts: u32,
113-
114-
/// Maximum number of filters to sync in a single gap sync batch
115-
pub max_filter_gap_sync_size: u32,
116-
11784
// Mempool configuration
11885
/// Enable tracking of unconfirmed (mempool) transactions.
11986
pub enable_mempool_tracking: bool,
@@ -159,9 +126,6 @@ pub struct ClientConfig {
159126
/// Maximum concurrent CFHeaders requests for parallel sync (default: 50).
160127
pub max_concurrent_cfheaders_requests_parallel: usize,
161128

162-
/// Enable flow control for CFHeaders requests (default: true).
163-
pub enable_cfheaders_flow_control: bool,
164-
165129
/// Timeout for CFHeaders requests in seconds (default: 30).
166130
pub cfheaders_request_timeout_secs: u64,
167131

@@ -210,18 +174,7 @@ impl Default for ClientConfig {
210174
log_level: "info".to_string(),
211175
user_agent: None,
212176
max_concurrent_filter_requests: 16,
213-
enable_filter_flow_control: true,
214177
filter_request_delay_ms: 0,
215-
enable_cfheader_gap_restart: true,
216-
cfheader_gap_check_interval_secs: 15,
217-
cfheader_gap_restart_cooldown_secs: 30,
218-
max_cfheader_gap_restart_attempts: 5,
219-
enable_filter_gap_restart: true,
220-
filter_gap_check_interval_secs: 20,
221-
min_filter_gap_size: 10,
222-
filter_gap_restart_cooldown_secs: 30,
223-
max_filter_gap_restart_attempts: 5,
224-
max_filter_gap_sync_size: 50000,
225178
// Mempool defaults
226179
enable_mempool_tracking: true,
227180
mempool_strategy: MempoolStrategy::FetchAll,
@@ -243,7 +196,6 @@ impl Default for ClientConfig {
243196
wallet_creation_time: None,
244197
// CFHeaders flow control defaults
245198
max_concurrent_cfheaders_requests_parallel: 50,
246-
enable_cfheaders_flow_control: true,
247199
cfheaders_request_timeout_secs: 30,
248200
max_cfheaders_retries: 3,
249201
// QRInfo defaults (simplified per plan)
@@ -341,12 +293,6 @@ impl ClientConfig {
341293
self
342294
}
343295

344-
/// Enable or disable filter flow control.
345-
pub fn with_filter_flow_control(mut self, enabled: bool) -> Self {
346-
self.enable_filter_flow_control = enabled;
347-
self
348-
}
349-
350296
/// Set delay between filter requests.
351297
pub fn with_filter_request_delay(mut self, delay_ms: u64) -> Self {
352298
self.filter_request_delay_ms = delay_ms;

dash-spv/src/client/config_test.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ mod tests {
2828
assert!(config.enable_persistence);
2929
assert_eq!(config.log_level, "info");
3030
assert_eq!(config.max_concurrent_filter_requests, 16);
31-
assert!(config.enable_filter_flow_control);
3231
assert_eq!(config.filter_request_delay_ms, 0);
3332

3433
// Mempool defaults
@@ -66,7 +65,6 @@ mod tests {
6665
.with_connection_timeout(Duration::from_secs(10))
6766
.with_log_level("debug")
6867
.with_max_concurrent_filter_requests(32)
69-
.with_filter_flow_control(false)
7068
.with_filter_request_delay(100)
7169
.with_mempool_tracking(MempoolStrategy::BloomFilter)
7270
.with_max_mempool_transactions(500)
@@ -80,7 +78,6 @@ mod tests {
8078
assert_eq!(config.connection_timeout, Duration::from_secs(10));
8179
assert_eq!(config.log_level, "debug");
8280
assert_eq!(config.max_concurrent_filter_requests, 32);
83-
assert!(!config.enable_filter_flow_control);
8481
assert_eq!(config.filter_request_delay_ms, 100);
8582

8683
// Mempool settings
@@ -196,28 +193,6 @@ mod tests {
196193

197194
// Removed selective strategy validation test; Selective variant no longer exists
198195

199-
#[test]
200-
fn test_cfheader_gap_settings() {
201-
let config = ClientConfig::default();
202-
203-
assert!(config.enable_cfheader_gap_restart);
204-
assert_eq!(config.cfheader_gap_check_interval_secs, 15);
205-
assert_eq!(config.cfheader_gap_restart_cooldown_secs, 30);
206-
assert_eq!(config.max_cfheader_gap_restart_attempts, 5);
207-
}
208-
209-
#[test]
210-
fn test_filter_gap_settings() {
211-
let config = ClientConfig::default();
212-
213-
assert!(config.enable_filter_gap_restart);
214-
assert_eq!(config.filter_gap_check_interval_secs, 20);
215-
assert_eq!(config.min_filter_gap_size, 10);
216-
assert_eq!(config.filter_gap_restart_cooldown_secs, 30);
217-
assert_eq!(config.max_filter_gap_restart_attempts, 5);
218-
assert_eq!(config.max_filter_gap_sync_size, 50000);
219-
}
220-
221196
#[test]
222197
fn test_request_control_defaults() {
223198
let config = ClientConfig::default();

dash-spv/src/client/filter_sync.rs

Lines changed: 0 additions & 171 deletions
This file was deleted.

dash-spv/src/client/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
//!
1818
//! - `block_processor.rs` (649 lines) - Block processing and validation
1919
//! - `config.rs` (484 lines) - Client configuration
20-
//! - `filter_sync.rs` (171 lines) - Filter synchronization
2120
//! - `message_handler.rs` (585 lines) - Network message handling
2221
//! - `status_display.rs` (242 lines) - Status display formatting
2322
//!
@@ -35,7 +34,6 @@
3534
// Existing extracted modules
3635
pub mod block_processor;
3736
pub mod config;
38-
pub mod filter_sync;
3937
pub mod message_handler;
4038
pub mod status_display;
4139

@@ -53,7 +51,6 @@ mod transactions;
5351
// Re-export public types from extracted modules
5452
pub use block_processor::{BlockProcessingTask, BlockProcessor};
5553
pub use config::ClientConfig;
56-
pub use filter_sync::FilterSyncCoordinator;
5754
pub use message_handler::MessageHandler;
5855
pub use status_display::StatusDisplay;
5956

0 commit comments

Comments
 (0)