From a1dfafe3313da91968386700fb4dffd89759db16 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 18 Jan 2023 17:33:56 +0100 Subject: [PATCH] docs: additional response handling docs (#917) --- crates/net/network/src/fetch/mod.rs | 3 +-- crates/net/network/src/state.rs | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/net/network/src/fetch/mod.rs b/crates/net/network/src/fetch/mod.rs index 60202a61e3..ddae20619e 100644 --- a/crates/net/network/src/fetch/mod.rs +++ b/crates/net/network/src/fetch/mod.rs @@ -388,10 +388,9 @@ pub(crate) enum BlockResponseOutcome { #[cfg(test)] mod tests { + use super::*; use crate::{peers::PeersManager, PeersConfig}; use reth_primitives::{H256, H512}; - - use super::*; use std::future::poll_fn; #[tokio::test(flavor = "multi_thread")] diff --git a/crates/net/network/src/state.rs b/crates/net/network/src/state.rs index b90c45b7d5..792d993146 100644 --- a/crates/net/network/src/state.rs +++ b/crates/net/network/src/state.rs @@ -355,6 +355,10 @@ where } /// Invoked when received a response from a connected peer. + /// + /// Delegates the response result to the fetcher which may return an outcome specific + /// instruction that needs to be handled in [Self::on_block_response_outcome]. This could be + /// a follow-up request or an instruction to slash the peer's reputation. fn on_eth_response(&mut self, peer: PeerId, resp: PeerResponseResult) -> Option { match resp { PeerResponseResult::BlockHeaders(res) => {