sort imports

This commit is contained in:
Boog900 2024-06-21 02:11:22 +01:00
parent cc5a980f18
commit b8e50eb96d
No known key found for this signature in database
GPG key ID: 42AB1287CB0041C2
2 changed files with 16 additions and 20 deletions

View file

@ -22,23 +22,18 @@ use tower::{Service, ServiceExt};
use tracing::{instrument, Instrument, Span}; use tracing::{instrument, Instrument, Span};
use async_buffer::{BufferAppender, BufferStream}; use async_buffer::{BufferAppender, BufferStream};
use cuprate_helper::asynch::rayon_spawn_async;
use fixed_bytes::ByteArrayVec;
use monero_p2p::{ use monero_p2p::{
client::InternalPeerID,
handles::ConnectionHandle, handles::ConnectionHandle,
services::{PeerSyncRequest, PeerSyncResponse}, services::{PeerSyncRequest, PeerSyncResponse},
NetworkZone, PeerRequest, PeerResponse, PeerSyncSvc, NetworkZone, PeerSyncSvc,
}; };
use monero_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT}; use monero_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT};
use monero_wire::protocol::{ChainRequest, ChainResponse};
use crate::{ use crate::{
client_pool::{ClientPool, ClientPoolDropGuard}, client_pool::{ClientPool, ClientPoolDropGuard},
constants::{ constants::{
BLOCK_DOWNLOADER_REQUEST_TIMEOUT, EMPTY_CHAIN_ENTRIES_BEFORE_TOP_ASSUMED, BLOCK_DOWNLOADER_REQUEST_TIMEOUT, EMPTY_CHAIN_ENTRIES_BEFORE_TOP_ASSUMED, LONG_BAN,
INITIAL_CHAIN_REQUESTS_TO_SEND, LONG_BAN, MAX_BLOCKS_IDS_IN_CHAIN_ENTRY, MAX_BLOCK_BATCH_LEN, MAX_DOWNLOAD_FAILURES,
MAX_BLOCK_BATCH_LEN, MAX_DOWNLOAD_FAILURES, MEDIUM_BAN,
}, },
}; };

View file

@ -1,37 +1,38 @@
use cuprate_helper::asynch::rayon_spawn_async;
use fixed_bytes::ByteArrayVec;
use monero_p2p::handles::ConnectionHandle;
use monero_p2p::{NetworkZone, PeerRequest, PeerResponse};
use monero_serai::block::Block;
use monero_serai::transaction::Transaction;
use monero_wire::protocol::{GetObjectsRequest, GetObjectsResponse};
use rayon::prelude::*;
use std::collections::HashSet; use std::collections::HashSet;
use monero_serai::{block::Block, transaction::Transaction};
use rayon::prelude::*;
use tokio::time::timeout; use tokio::time::timeout;
use tower::{Service, ServiceExt}; use tower::{Service, ServiceExt};
use tracing::instrument; use tracing::instrument;
use crate::block_downloader::BlockDownloadTaskResponse; use monero_p2p::{NetworkZone, PeerRequest, PeerResponse, handles::ConnectionHandle};
use monero_wire::protocol::{GetObjectsRequest, GetObjectsResponse};
use cuprate_helper::asynch::rayon_spawn_async;
use fixed_bytes::ByteArrayVec;
use crate::{ use crate::{
block_downloader::{BlockBatch, BlockDownloadError}, block_downloader::{BlockBatch, BlockDownloadError, BlockDownloadTaskResponse},
client_pool::ClientPoolDropGuard, client_pool::ClientPoolDropGuard,
constants::{BLOCK_DOWNLOADER_REQUEST_TIMEOUT, MAX_TRANSACTION_BLOB_SIZE, MEDIUM_BAN}, constants::{BLOCK_DOWNLOADER_REQUEST_TIMEOUT, MAX_TRANSACTION_BLOB_SIZE, MEDIUM_BAN},
}; };
/// Attempts to request a batch of blocks from a peer, returning [`BlockDownloadTaskResponse`].
#[instrument( #[instrument(
level = "debug", level = "debug",
name = "download_batch", name = "download_batch",
skip_all, skip_all,
fields( fields(
start_height = expected_start_height, start_height = expected_start_height,
attempt attempt = _attempt
) )
)] )]
pub async fn download_batch_task<N: NetworkZone>( pub async fn download_batch_task<N: NetworkZone>(
client: ClientPoolDropGuard<N>, client: ClientPoolDropGuard<N>,
ids: ByteArrayVec<32>, ids: ByteArrayVec<32>,
expected_start_height: u64, expected_start_height: u64,
attempt: usize, _attempt: usize,
) -> BlockDownloadTaskResponse<N> { ) -> BlockDownloadTaskResponse<N> {
BlockDownloadTaskResponse { BlockDownloadTaskResponse {
start_height: expected_start_height, start_height: expected_start_height,