Skip to content

Commit

Permalink
Change sync extension to update pivot after transitioning to Full
Browse files Browse the repository at this point in the history
  • Loading branch information
foriequal0 committed Dec 10, 2019
1 parent eb6b204 commit afcf587
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sync/src/block/downloader/header.rs
Expand Up @@ -62,6 +62,10 @@ impl HeaderDownloader {
}
}

pub fn update_pivot(&mut self, hash: BlockHash) {
self.pivot = hash;
}

pub fn best_hash(&self) -> BlockHash {
self.best_hash
}
Expand Down
4 changes: 4 additions & 0 deletions sync/src/block/extension.rs
Expand Up @@ -1048,6 +1048,10 @@ impl Extension {

fn transition_to_full(&mut self) {
cdebug!(SYNC, "Transitioning state to {:?}", State::Full);
let best_hash = self.client.best_block_header().hash();
for downloader in self.header_downloaders.values_mut() {
downloader.update_pivot(best_hash);
}
self.state = State::Full;
}
}
Expand Down

0 comments on commit afcf587

Please sign in to comment.