Merge remote-tracking branch 'parity/master' into bft

This commit is contained in:
keorn
2016-11-15 10:26:37 +00:00
400 changed files with 13886 additions and 3861 deletions

View File

@@ -48,7 +48,7 @@ pub struct SyncConfig {
/// Max blocks to download ahead
pub max_download_ahead_blocks: usize,
/// Network ID
pub network_id: U256,
pub network_id: usize,
/// Main "eth" subprotocol name.
pub subprotocol_name: [u8; 3],
/// Fork block to check
@@ -61,7 +61,7 @@ impl Default for SyncConfig {
fn default() -> SyncConfig {
SyncConfig {
max_download_ahead_blocks: 20000,
network_id: U256::from(1),
network_id: 1,
subprotocol_name: ETH_PROTOCOL,
fork_block: None,
warp_sync: false,
@@ -79,6 +79,9 @@ pub trait SyncProvider: Send + Sync {
/// Get peers information
fn peers(&self) -> Vec<PeerInfo>;
/// Get the enode if available.
fn enode(&self) -> Option<String>;
}
/// Peer connection information
@@ -158,6 +161,10 @@ impl SyncProvider for EthSync {
self.eth_handler.sync.write().peers(&sync_io)
}).unwrap_or(Vec::new())
}
fn enode(&self) -> Option<String> {
self.network.external_url()
}
}
struct SyncProtocolHandler {
@@ -273,6 +280,7 @@ impl ChainNotify for EthSync {
}
fn stop(&self) {
self.handler.snapshot_service.abort_restore();
self.network.stop().unwrap_or_else(|e| warn!("Error stopping network: {:?}", e));
}