Skip to content

Commit

Permalink
Flip the switch on PushHeaders
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Zabaluev committed Nov 5, 2019
1 parent 351a1c1 commit 5caece7
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions jormungandr/src/network/client/mod.rs
Expand Up @@ -235,15 +235,12 @@ where
"peer requests missing part of the chain";
"checkpoints" => ?req.from,
"to" => ?req.to);
self.push_missing_blocks(req);
self.push_missing_headers(req);
}
}
Ok(Continue.into())
}

// FIXME: use this to handle BlockEvent::Missing events when two-stage
// chain pull processing is implemented in the blockchain task.
#[allow(dead_code)]
fn push_missing_headers(&mut self, req: ChainPullRequest<HeaderHash>) {
let (reply_handle, stream) =
intercom::stream_reply::<Header, network_core::error::Error>(self.logger.clone());
Expand All @@ -266,31 +263,6 @@ where
}),
);
}

// Temporary support for pushing chain blocks without two-stage
// retrieval.
fn push_missing_blocks(&mut self, req: ChainPullRequest<HeaderHash>) {
let (reply_handle, stream) =
intercom::stream_reply::<Block, core_error::Error>(self.logger.clone());
self.client_box
.send_to(ClientMsg::PullBlocksToTip(req.from, reply_handle));
let done_logger = self.logger.clone();
let err_logger = self.logger.clone();
self.global_state.spawn(
self.service
.upload_blocks(stream)
.map(move |_| {
debug!(done_logger, "finished pushing blocks");
})
.map_err(move |e| {
info!(
err_logger,
"UploadBlocks request failed";
"error" => ?e,
);
}),
);
}
}

impl<S> Client<S>
Expand Down

0 comments on commit 5caece7

Please sign in to comment.