wait_for_min_peers should continue waiting if none connected (#2326)

* wait_for_min_peers should continue waiting if none connected

* allow no peers to go in non-production mode, such as travis-ci test
This commit is contained in:
Gary Yu 2019-01-10 21:08:51 +08:00 committed by GitHub
parent cd9a539288
commit ea4407a919
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,6 +18,7 @@ use std::time;
use crate::chain;
use crate::common::types::{SyncState, SyncStatus};
use crate::core::global;
use crate::core::pow::Difficulty;
use crate::grin::sync::body_sync::BodySync;
use crate::grin::sync::header_sync::HeaderSync;
@ -87,7 +88,9 @@ impl SyncRunner {
&& head.total_difficulty > Difficulty::zero())
|| n > wait_secs
{
break;
if wp.len() > 0 || !global::is_production_mode() {
break;
}
}
thread::sleep(time::Duration::from_secs(1));
n += 1;