Don't coneect peers on each sync

This commit is contained in:
arkpar 2016-12-13 13:23:10 +01:00
parent fa504e510f
commit 49ae375605

View File

@ -237,6 +237,9 @@ impl<C> TestNet<C> where C: FlushingBlockChainClient {
} }
pub fn start(&mut self) { pub fn start(&mut self) {
if self.started {
return;
}
for peer in 0..self.peers.len() { for peer in 0..self.peers.len() {
for client in 0..self.peers.len() { for client in 0..self.peers.len() {
if peer != client { if peer != client {
@ -246,6 +249,7 @@ impl<C> TestNet<C> where C: FlushingBlockChainClient {
} }
} }
} }
self.started = true;
} }
pub fn sync_step(&mut self) { pub fn sync_step(&mut self) {
@ -306,10 +310,7 @@ impl<C> TestNet<C> where C: FlushingBlockChainClient {
} }
pub fn sync_steps(&mut self, count: usize) { pub fn sync_steps(&mut self, count: usize) {
if !self.started {
self.start(); self.start();
self.started = true;
}
for _ in 0..count { for _ in 0..count {
self.sync_step(); self.sync_step();
} }