Backporting to beta (#3718)

* Disaable peer if no common block found

* v1.4.6


Former-commit-id: 5feccf11d2156e3444f1c7dbacc76212ff06d319
This commit is contained in:
Arkadiy Paronyan
2016-12-05 17:09:55 +01:00
committed by GitHub
parent 03f35d7f82
commit f8683058b3
8 changed files with 38 additions and 18 deletions

View File

@@ -123,6 +123,7 @@ pub struct TestPeer {
pub struct TestNet {
pub peers: Vec<TestPeer>,
pub started: bool,
pub disconnect_events: Vec<(PeerId, PeerId)>, //disconnected (initiated by, to)
}
impl TestNet {
@@ -140,6 +141,7 @@ impl TestNet {
let mut net = TestNet {
peers: Vec::new(),
started: false,
disconnect_events: Vec::new(),
};
for _ in 0..n {
let chain = TestBlockChainClient::new();
@@ -190,6 +192,7 @@ impl TestNet {
// notify this that disconnecting peers are disconnecting
let mut io = TestIo::new(&mut p.chain, &p.snapshot_service, &mut p.queue, Some(*d));
p.sync.write().on_peer_aborting(&mut io, *d);
self.disconnect_events.push((peer, *d));
}
to_disconnect
};