fix previous merge

This commit is contained in:
Boog900 2024-06-12 01:46:17 +01:00
parent c5a493a186
commit cefd8a7a3f
No known key found for this signature in database
GPG key ID: 42AB1287CB0041C2
2 changed files with 13 additions and 8 deletions

View file

@ -626,7 +626,7 @@ where
// block downloader. // block downloader.
self.inflight_requests.get(&start_height).inspect(|entry| { self.inflight_requests.get(&start_height).inspect(|entry| {
tracing::warn!( tracing::warn!(
"Received an invalid chain from peer: {}, exiting block downloader (it will be restarted).", "Received an invalid chain from peer: {}, exiting block downloader (it should be restarted).",
entry.peer_who_told_us entry.peer_who_told_us
); );
entry.peer_who_told_us_handle.ban_peer(LONG_BAN) entry.peer_who_told_us_handle.ban_peer(LONG_BAN)
@ -867,6 +867,11 @@ async fn request_batch_from_peer<N: NetworkZone>(
.number() .number()
.is_some_and(|height| height == expected_height) .is_some_and(|height| height == expected_height)
{ {
tracing::warn!(
"Invalid chain, expected height: {expected_height}, got height: {:?}",
block.number()
);
// This peer probably did nothing wrong, it was the peer who told us this blockID which // This peer probably did nothing wrong, it was the peer who told us this blockID which
// is misbehaving. // is misbehaving.
return Err(BlockDownloadError::ChainInvalid); return Err(BlockDownloadError::ChainInvalid);

View file

@ -30,9 +30,7 @@ mod constants;
mod inbound_server; mod inbound_server;
mod sync_states; mod sync_states;
use crate::block_downloader::{ use block_downloader::{BlockBatch, BlockDownloaderConfig, ChainSvcRequest, ChainSvcResponse};
BlockBatch, BlockDownloaderConfig, ChainSvcRequest, ChainSvcResponse,
};
pub use broadcast::{BroadcastRequest, BroadcastSvc}; pub use broadcast::{BroadcastRequest, BroadcastSvc};
use client_pool::ClientPoolDropGuard; use client_pool::ClientPoolDropGuard;
pub use config::P2PConfig; pub use config::P2PConfig;
@ -41,10 +39,12 @@ use monero_p2p::services::PeerSyncRequest;
/// Initializes the P2P [`NetworkInterface`] for a specific [`NetworkZone`]. /// Initializes the P2P [`NetworkInterface`] for a specific [`NetworkZone`].
/// ///
/// This function starts all the tasks to maintain connections/ accept connections/ make connections. /// This function starts all the tasks to maintain/accept/make connections.
/// ///
/// To use you must provide, a peer request handler, which is given to each connection and a core sync service /// # Usage
/// which keeps track of the sync state of our node. /// You must provide:
/// - A peer request handler, which is given to each connection
/// - A core sync service, which keeps track of the sync state of our node
#[instrument(level = "debug", name = "net", skip_all, fields(zone = N::NAME))] #[instrument(level = "debug", name = "net", skip_all, fields(zone = N::NAME))]
pub async fn initialize_network<N, R, CS>( pub async fn initialize_network<N, R, CS>(
peer_req_handler: R, peer_req_handler: R,