Implement get_block_roots for syncing

This commit is contained in:
Paul Hauner
2019-03-22 14:20:49 +11:00
parent f96a3282b5
commit 96ba1c8f77
5 changed files with 146 additions and 20 deletions

View File

@@ -165,6 +165,15 @@ impl SimpleSync {
}
}
pub fn on_beacon_block_roots_response(
&mut self,
peer_id: PeerId,
reponse: BeaconBlockRootsResponse,
network: &mut NetworkContext,
) {
//
}
fn request_block_roots(
&mut self,
peer_id: PeerId,
@@ -174,9 +183,12 @@ impl SimpleSync {
) {
// Potentially set state to sync.
if self.state == SyncState::Idle && count > SLOT_IMPORT_TOLERANCE {
debug!(self.log, "Entering downloading sync state.");
self.state = SyncState::Downloading;
}
debug!(self.log, "Requesting {} blocks from {:?}.", count, &peer_id);
// TODO: handle count > max count.
network.send_rpc_request(
peer_id.clone(),