Skip to content

Commit

Permalink
fix forward sync explicit index ref
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Jun 5, 2020
1 parent 14159f4 commit 5113b85
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions base_layer/core/src/base_node/states/forward_block_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,12 @@ async fn download_blocks<B: BlockchainBackend + 'static>(
match shared.comms.fetch_blocks_with_hashes(curr_headers.clone()).await {
Ok(blocks) => {
info!(target: LOG_TARGET, "Received {} blocks from peer", blocks.len());

if let StatusInfo::BlockSync(ref mut info) = shared.info {
info.tip_height = Some(blocks[blocks.len() - 1].block().header.height);
info.local_height = Some(blocks[0].block().header.height);
}
shared.publish_event_info().await;
for i in 0..blocks.len() {
if let StatusInfo::BlockSync(ref mut info) = shared.info {
info.tip_height = Some(blocks[blocks.len() - 1].block().header.height);
info.local_height = Some(blocks[0].block().header.height + (i as u64));
}
shared.publish_event_info().await;
let hist_block = &blocks[i];
let header = &curr_headers[i];
let block_hash = hist_block.block().hash();
Expand Down

0 comments on commit 5113b85

Please sign in to comment.