Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions crates/net/p2p/src/full_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,10 @@ where

/// Returns the [`SealedBlock`] if the request is complete and valid.
fn take_block(&mut self) -> Option<SealedBlock<Client::Block>> {
if self.header.is_none() || self.body.is_none() {
return None
}

let header = self.header.take().unwrap();
let resp = self.body.take().unwrap();
let (header, resp) = match (self.header.as_ref(), self.body.as_ref()) {
(Some(_), Some(_)) => (self.header.take().unwrap(), self.body.take().unwrap()),
_ => return None,
};
match resp {
BodyResponse::Validated(body) => Some(SealedBlock::from_sealed_parts(header, body)),
BodyResponse::PendingValidation(resp) => {
Expand Down
Loading