Merge branch 'master' into les-impl
This commit is contained in:
@@ -42,7 +42,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
|
||||
@@ -55,7 +55,7 @@ impl Default for SyncConfig {
|
||||
fn default() -> SyncConfig {
|
||||
SyncConfig {
|
||||
max_download_ahead_blocks: 20000,
|
||||
network_id: U256::from(1),
|
||||
network_id: 1,
|
||||
subprotocol_name: *b"eth",
|
||||
fork_block: None,
|
||||
warp_sync: false,
|
||||
@@ -73,6 +73,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
|
||||
@@ -143,6 +146,10 @@ impl SyncProvider for EthSync {
|
||||
self.handler.sync.write().peers(&sync_io)
|
||||
}).unwrap_or(Vec::new())
|
||||
}
|
||||
|
||||
fn enode(&self) -> Option<String> {
|
||||
self.network.external_url()
|
||||
}
|
||||
}
|
||||
|
||||
struct SyncProtocolHandler {
|
||||
|
||||
@@ -188,7 +188,7 @@ pub struct SyncStatus {
|
||||
/// Syncing protocol version. That's the maximum protocol version we connect to.
|
||||
pub protocol_version: u8,
|
||||
/// The underlying p2p network version.
|
||||
pub network_id: U256,
|
||||
pub network_id: usize,
|
||||
/// `BlockChain` height for the moment the sync started.
|
||||
pub start_block_number: BlockNumber,
|
||||
/// Last fully downloaded and imported block number (if any).
|
||||
@@ -269,7 +269,7 @@ struct PeerInfo {
|
||||
/// Peer chain genesis hash
|
||||
genesis: H256,
|
||||
/// Peer network id
|
||||
network_id: U256,
|
||||
network_id: usize,
|
||||
/// Peer best block hash
|
||||
latest_hash: H256,
|
||||
/// Peer total difficulty if known
|
||||
@@ -328,7 +328,7 @@ pub struct ChainSync {
|
||||
/// Last propagated block number
|
||||
last_sent_block_number: BlockNumber,
|
||||
/// Network ID
|
||||
network_id: U256,
|
||||
network_id: usize,
|
||||
/// Optional fork block to check
|
||||
fork_block: Option<(BlockNumber, H256)>,
|
||||
/// Snapshot downloader.
|
||||
@@ -2145,7 +2145,7 @@ mod tests {
|
||||
PeerInfo {
|
||||
protocol_version: 0,
|
||||
genesis: H256::zero(),
|
||||
network_id: U256::zero(),
|
||||
network_id: 0,
|
||||
latest_hash: peer_latest_hash,
|
||||
difficulty: None,
|
||||
asking: PeerAsking::Nothing,
|
||||
|
||||
Reference in New Issue
Block a user