doc updates

This commit is contained in:
Boog900 2024-09-26 01:22:48 +01:00
parent 42f74c76c4
commit 1e83064f63
No known key found for this signature in database
GPG key ID: 42AB1287CB0041C2
4 changed files with 26 additions and 19 deletions

View file

@ -1,10 +1,10 @@
use futures::channel::oneshot;
use std::sync::Mutex;
use std::{ use std::{
fmt::{Debug, Display, Formatter}, fmt::{Debug, Display, Formatter},
sync::Arc, sync::{Arc, Mutex},
task::{ready, Context, Poll}, task::{ready, Context, Poll},
}; };
use futures::channel::oneshot;
use tokio::{ use tokio::{
sync::{mpsc, OwnedSemaphorePermit, Semaphore}, sync::{mpsc, OwnedSemaphorePermit, Semaphore},
task::JoinHandle, task::JoinHandle,
@ -14,6 +14,8 @@ use tower::{Service, ServiceExt};
use tracing::Instrument; use tracing::Instrument;
use cuprate_helper::asynch::InfallibleOneshotReceiver; use cuprate_helper::asynch::InfallibleOneshotReceiver;
use cuprate_pruning::PruningSeed;
use cuprate_wire::CoreSyncData;
use crate::{ use crate::{
handles::{ConnectionGuard, ConnectionHandle}, handles::{ConnectionGuard, ConnectionHandle},
@ -27,8 +29,6 @@ mod request_handler;
mod timeout_monitor; mod timeout_monitor;
pub use connector::{ConnectRequest, Connector}; pub use connector::{ConnectRequest, Connector};
use cuprate_pruning::PruningSeed;
use cuprate_wire::CoreSyncData;
pub use handshaker::{DoHandshakeRequest, HandshakeError, HandshakerBuilder}; pub use handshaker::{DoHandshakeRequest, HandshakeError, HandshakerBuilder};
/// An internal identifier for a given peer, will be their address if known /// An internal identifier for a given peer, will be their address if known

View file

@ -4,15 +4,15 @@
//! to complete a handshake with them. //! to complete a handshake with them.
//! //!
//! This module also contains a [`ping`] function that can be used to check if an address is reachable. //! This module also contains a [`ping`] function that can be used to check if an address is reachable.
use futures::{FutureExt, SinkExt, Stream, StreamExt};
use std::sync::Mutex;
use std::{ use std::{
future::Future, future::Future,
marker::PhantomData, marker::PhantomData,
pin::Pin, pin::Pin,
sync::Arc, sync::{Arc, Mutex},
task::{Context, Poll}, task::{Context, Poll},
}; };
use futures::{FutureExt, SinkExt, Stream, StreamExt};
use tokio::{ use tokio::{
sync::{mpsc, OwnedSemaphorePermit, Semaphore}, sync::{mpsc, OwnedSemaphorePermit, Semaphore},
time::{error::Elapsed, timeout}, time::{error::Elapsed, timeout},

View file

@ -1,3 +1,12 @@
use std::{
fmt::{Debug, Formatter},
future::Future,
pin::Pin,
sync::{Arc, Mutex},
task::{Context, Poll},
time::Duration,
};
use futures::{FutureExt, StreamExt}; use futures::{FutureExt, StreamExt};
use indexmap::IndexMap; use indexmap::IndexMap;
use monero_serai::{ use monero_serai::{
@ -5,15 +14,6 @@ use monero_serai::{
transaction::{Input, Timelock, Transaction, TransactionPrefix}, transaction::{Input, Timelock, Transaction, TransactionPrefix},
}; };
use proptest::{collection::vec, prelude::*}; use proptest::{collection::vec, prelude::*};
use std::sync::Mutex;
use std::{
fmt::{Debug, Formatter},
future::Future,
pin::Pin,
sync::Arc,
task::{Context, Poll},
time::Duration,
};
use tokio::time::timeout; use tokio::time::timeout;
use tower::{service_fn, Service}; use tower::{service_fn, Service};
@ -24,8 +24,10 @@ use cuprate_p2p_core::{
}; };
use cuprate_pruning::PruningSeed; use cuprate_pruning::PruningSeed;
use cuprate_types::{BlockCompleteEntry, TransactionBlobs}; use cuprate_types::{BlockCompleteEntry, TransactionBlobs};
use cuprate_wire::protocol::{ChainResponse, GetObjectsResponse}; use cuprate_wire::{
use cuprate_wire::CoreSyncData; protocol::{ChainResponse, GetObjectsResponse},
CoreSyncData,
};
use crate::{ use crate::{
block_downloader::{download_blocks, BlockDownloaderConfig, ChainSvcRequest, ChainSvcResponse}, block_downloader::{download_blocks, BlockDownloaderConfig, ChainSvcRequest, ChainSvcResponse},

View file

@ -128,6 +128,11 @@ impl<N: NetworkZone> ClientPool<N> {
peers.iter().filter_map(|peer| self.borrow_client(peer)) peers.iter().filter_map(|peer| self.borrow_client(peer))
} }
/// Borrows all [`Client`]s from the pool that have claimed a higher cumulative difficulty than
/// the amount passed in.
///
/// The [`Client`]s are wrapped in [`ClientPoolDropGuard`] which
/// will return the clients to the pool when they are dropped.
pub fn clients_with_more_cumulative_difficulty( pub fn clients_with_more_cumulative_difficulty(
self: &Arc<Self>, self: &Arc<Self>,
cumulative_difficulty: u128, cumulative_difficulty: u128,