From 96e939f42e25c2c4a8ee4565a607546640602a77 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Wed, 21 Oct 2020 20:06:35 +0200 Subject: [PATCH] client/network: Remove original_request in block request events (#7369) The `original_request` field of each `block_request::Event` variant is not used. With that in mind, this commit removes the field. --- substrate/client/network/src/behaviour.rs | 2 +- substrate/client/network/src/block_requests.rs | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/substrate/client/network/src/behaviour.rs b/substrate/client/network/src/behaviour.rs index 6b3cfac38a..c8684eba62 100644 --- a/substrate/client/network/src/behaviour.rs +++ b/substrate/client/network/src/behaviour.rs @@ -429,7 +429,7 @@ impl NetworkBehaviourEventProcess { + block_requests::Event::Response { peer, response, request_duration } => { self.events.push_back(BehaviourOut::OpaqueRequestFinished { peer: peer.clone(), protocol: self.block_requests.protocol_name().to_owned(), diff --git a/substrate/client/network/src/block_requests.rs b/substrate/client/network/src/block_requests.rs index 7ee8f18f3a..ace63e6e1c 100644 --- a/substrate/client/network/src/block_requests.rs +++ b/substrate/client/network/src/block_requests.rs @@ -85,8 +85,6 @@ pub enum Event { /// A response to a block request has arrived. Response { peer: PeerId, - /// The original request passed to `send_request`. - original_request: message::BlockRequest, response: message::BlockResponse, /// Time elapsed between the start of the request and the response. request_duration: Duration, @@ -99,8 +97,6 @@ pub enum Event { /// > For that, you must check the value returned by `send_request`. RequestCancelled { peer: PeerId, - /// The original request passed to `send_request`. - original_request: message::BlockRequest, /// Time elapsed between the start of the request and the cancellation. request_duration: Duration, }, @@ -108,8 +104,6 @@ pub enum Event { /// A request has timed out. RequestTimeout { peer: PeerId, - /// The original request passed to `send_request`. - original_request: message::BlockRequest, /// Time elapsed between the start of the request and the timeout. request_duration: Duration, } @@ -515,7 +509,6 @@ where ); let ev = Event::RequestCancelled { peer: peer_id.clone(), - original_request: ongoing_request.request.clone(), request_duration: ongoing_request.emitted.elapsed(), }; self.pending_events.push_back(NetworkBehaviourAction::GenerateEvent(ev)); @@ -670,7 +663,6 @@ where let id = original_request.id; let ev = Event::Response { peer, - original_request, response: message::BlockResponse:: { id, blocks }, request_duration, }; @@ -713,7 +705,6 @@ where ); let ev = Event::RequestTimeout { peer: peer.clone(), - original_request, request_duration, }; return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev));