From 51e67163a83ce7b127fc9066deb28b8bf2be11b0 Mon Sep 17 00:00:00 2001 From: Boog900 <54e72d8a-345f-4599-bd90-c6b9bc7d0ec5@aleeas.com> Date: Mon, 3 Jun 2024 16:08:10 +0100 Subject: [PATCH] Keep a longer of queue of blocks to get --- p2p/cuprate-p2p/src/bin/test_init.rs | 10 ++++++---- p2p/cuprate-p2p/src/block_downloader.rs | 4 ++-- p2p/monero-p2p/Cargo.toml | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/p2p/cuprate-p2p/src/bin/test_init.rs b/p2p/cuprate-p2p/src/bin/test_init.rs index 3ad4c0f2..ffc06988 100644 --- a/p2p/cuprate-p2p/src/bin/test_init.rs +++ b/p2p/cuprate-p2p/src/bin/test_init.rs @@ -123,7 +123,7 @@ impl Service for OurChainSvc { } } -#[tokio::main(flavor = "multi_thread", worker_threads = 12)] +#[tokio::main(flavor = "multi_thread")] async fn main() { tracing_subscriber::fmt() .with_max_level(Level::DEBUG) @@ -151,7 +151,7 @@ async fn main() { .await .unwrap(); - sleep(Duration::from_secs(15)).await; + sleep(Duration::from_secs(17)).await; loop { let mut buffer = download_blocks( @@ -162,8 +162,8 @@ async fn main() { buffer_size: 50_000_000, in_progress_queue_size: 30_000_000, check_client_pool_interval: Duration::from_secs(20), - target_batch_size: 1_000_000, - initial_batch_size: 100, + target_batch_size: 2_000_000, + initial_batch_size: 10, }, ); @@ -175,6 +175,8 @@ async fn main() { ) } + panic!(); + sleep(Duration::from_secs(2)).await; } } diff --git a/p2p/cuprate-p2p/src/block_downloader.rs b/p2p/cuprate-p2p/src/block_downloader.rs index a377a6a3..0a3f0d5e 100644 --- a/p2p/cuprate-p2p/src/block_downloader.rs +++ b/p2p/cuprate-p2p/src/block_downloader.rs @@ -363,7 +363,7 @@ where client: ClientPoolDropGuard, ) { if self.chain_entry_task.len() < 2 - && chain_tracker.block_requests_queued(self.amount_of_blocks_to_request) < 30 + && chain_tracker.block_requests_queued(self.amount_of_blocks_to_request) < 500 && chain_tracker.should_ask_for_next_chain_entry(&client.info.pruning_seed) { let history = chain_tracker.get_simple_history(); @@ -517,7 +517,7 @@ where let mut amount_of_blocks_to_request_updated_at = 0; let mut check_client_pool_interval = interval(self.config.check_client_pool_interval); - check_client_pool_interval.set_missed_tick_behavior(MissedTickBehavior::Delay); + check_client_pool_interval.set_missed_tick_behavior(MissedTickBehavior::Skip); loop { tokio::select! { diff --git a/p2p/monero-p2p/Cargo.toml b/p2p/monero-p2p/Cargo.toml index e416fbbb..e4700a61 100644 --- a/p2p/monero-p2p/Cargo.toml +++ b/p2p/monero-p2p/Cargo.toml @@ -10,7 +10,7 @@ default = ["borsh"] borsh = ["dep:borsh", "monero-pruning/borsh"] [dependencies] -cuprate-helper = { path = "../../helper" } +cuprate-helper = { path = "../../helper", features = ["asynch"] } monero-wire = { path = "../../net/monero-wire", features = ["tracing"] } monero-pruning = { path = "../../pruning" }