Drain blocks on peer disconnect (#8553)

* Drain blocks on peer disconnect

* Finish comment

* Fixed test

* Update client/network/src/protocol/sync.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Arkadiy Paronyan
2021-04-07 15:43:24 +03:00
committed by GitHub
parent dd89d994ce
commit e3c1fe299a
2 changed files with 50 additions and 8 deletions
+3 -1
View File
@@ -526,7 +526,9 @@ impl<B: BlockT> Protocol<B> {
}
if let Some(_peer_data) = self.peers.remove(&peer) {
self.sync.peer_disconnected(&peer);
if let Some(sync::OnBlockData::Import(origin, blocks)) = self.sync.peer_disconnected(&peer) {
self.pending_messages.push_back(CustomMessageOutcome::BlockImport(origin, blocks));
}
Ok(())
} else {
Err(())