wait until orphan blocks are verifying before responding with headers

This commit is contained in:
Svyatoslav Nikolsky 2016-11-25 15:43:24 +03:00
parent 61ec18897d
commit 45c13d9c85
1 changed files with 3 additions and 1 deletions

View File

@ -1103,7 +1103,9 @@ impl<T> SynchronizationClientCore<T> where T: TaskExecutor {
let blocks_headers_to_verify: Vec<_> = blocks_to_verify.iter().map(|&(ref h, ref b)| (h.clone(), b.block_header.clone())).collect();
chain.verify_blocks(blocks_headers_to_verify);
// remember that we are verifying block from this peer
self.verifying_blocks_by_peer.insert(block_hash.clone(), peer_index);
for &(ref verifying_block_hash, _) in &blocks_to_verify {
self.verifying_blocks_by_peer.insert(verifying_block_hash.clone(), peer_index);
}
match self.verifying_blocks_futures.entry(peer_index) {
Entry::Occupied(mut entry) => {
entry.get_mut().0.insert(block_hash.clone());