fix merge
Some checks failed
Audit / audit (push) Has been cancelled
Deny / audit (push) Has been cancelled

This commit is contained in:
Boog900 2024-06-06 02:12:15 +01:00
parent 9edcb760f7
commit d3e784d432
No known key found for this signature in database
GPG key ID: 42AB1287CB0041C2
4 changed files with 81 additions and 27 deletions

62
Cargo.lock generated
View file

@ -50,6 +50,16 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "async-buffer"
version = "0.1.0"
dependencies = [
"futures",
"pin-project",
"thiserror",
"tokio",
]
[[package]] [[package]]
name = "async-lock" name = "async-lock"
version = "3.3.0" version = "3.3.0"
@ -502,6 +512,7 @@ dependencies = [
name = "cuprate-p2p" name = "cuprate-p2p"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"async-buffer",
"bytes", "bytes",
"cuprate-helper", "cuprate-helper",
"cuprate-test-utils", "cuprate-test-utils",
@ -525,6 +536,7 @@ dependencies = [
"tokio-util", "tokio-util",
"tower", "tower",
"tracing", "tracing",
"tracing-subscriber",
] ]
[[package]] [[package]]
@ -613,7 +625,7 @@ dependencies = [
] ]
[[package]] [[package]]
name = "dandelion_tower" name = "dandelion-tower"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"futures", "futures",
@ -1463,6 +1475,16 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "nu-ansi-term"
version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
dependencies = [
"overload",
"winapi",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.18" version = "0.2.18"
@ -1510,6 +1532,12 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "overload"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]] [[package]]
name = "page_size" name = "page_size"
version = "0.6.0" version = "0.6.0"
@ -2136,6 +2164,15 @@ dependencies = [
"keccak", "keccak",
] ]
[[package]]
name = "sharded-slab"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
dependencies = [
"lazy_static",
]
[[package]] [[package]]
name = "signal-hook-registry" name = "signal-hook-registry"
version = "1.4.2" version = "1.4.2"
@ -2476,6 +2513,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"valuable",
]
[[package]]
name = "tracing-log"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
dependencies = [
"log",
"once_cell",
"tracing-core",
] ]
[[package]] [[package]]
@ -2484,7 +2533,12 @@ version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
dependencies = [ dependencies = [
"nu-ansi-term",
"sharded-slab",
"smallvec",
"thread_local",
"tracing-core", "tracing-core",
"tracing-log",
] ]
[[package]] [[package]]
@ -2543,6 +2597,12 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "valuable"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.4" version = "0.9.4"

View file

@ -153,30 +153,24 @@ async fn main() {
sleep(Duration::from_secs(15)).await; sleep(Duration::from_secs(15)).await;
loop { let mut buffer = download_blocks(
let mut buffer = download_blocks( net.pool.clone(),
net.pool.clone(), net.sync_states_svc.clone(),
net.sync_states_svc.clone(), OurChainSvc,
OurChainSvc, BlockDownloaderConfig {
BlockDownloaderConfig { buffer_size: 50_000_000,
buffer_size: 50_000_000, in_progress_queue_size: 30_000_000,
in_progress_queue_size: 30_000_000, check_client_pool_interval: Duration::from_secs(10),
check_client_pool_interval: Duration::from_secs(10), target_batch_size: 5_000_000,
target_batch_size: 5_000_000, initial_batch_size: 10,
initial_batch_size: 10, },
}, );
);
while let Some(entry) = buffer.next().await { while let Some(entry) = buffer.next().await {
tracing::info!( tracing::info!(
"height: {}, amount{}", "height: {}, amount{}",
entry.blocks[0].0.number().unwrap(), entry.blocks[0].0.number().unwrap(),
entry.blocks.len() entry.blocks.len()
) )
}
panic!();
sleep(Duration::from_secs(2)).await;
} }
} }

View file

@ -3,9 +3,8 @@
mod chain_tracker; mod chain_tracker;
use futures::FutureExt;
use std::cmp::{max, min, Ordering, Reverse}; use std::cmp::{max, min, Ordering, Reverse};
use std::collections::{BTreeMap, BinaryHeap, HashSet, VecDeque}; use std::collections::{BTreeMap, BinaryHeap, HashSet};
use std::sync::Arc; use std::sync::Arc;
use std::time::Duration; use std::time::Duration;

View file

@ -20,6 +20,7 @@ use monero_p2p::{
CoreSyncSvc, NetworkZone, PeerRequestHandler, CoreSyncSvc, NetworkZone, PeerRequestHandler,
}; };
pub mod block_downloader;
mod broadcast; mod broadcast;
mod client_pool; mod client_pool;
pub mod config; pub mod config;