Rename network_id to chain_id

This commit is contained in:
Age Manning 2019-03-22 12:39:45 +11:00
parent 0a59a73894
commit 844fdc0fb9
No known key found for this signature in database
GPG Key ID: 05EED64B79E06A93
2 changed files with 7 additions and 7 deletions

View File

@ -36,7 +36,7 @@ pub struct SimpleSync {
/// The current state of the syncing protocol.
state: SyncState,
/// The network id, for quick HELLO RPC message lookup.
network_id: u8,
chain_id: u8,
/// The latest epoch of the syncing chain.
latest_finalized_epoch: Epoch,
/// The latest block of the syncing chain.
@ -53,7 +53,7 @@ impl SimpleSync {
chain: beacon_chain.clone(),
known_peers: HashMap::new(),
state: SyncState::Idle,
network_id: beacon_chain.get_spec().network_id,
chain_id: beacon_chain.get_spec().chain_id,
latest_finalized_epoch: state.finalized_epoch,
latest_slot: state.slot - 1, //TODO: Build latest block function into Beacon chain and correct this
log: sync_logger,
@ -65,7 +65,7 @@ impl SimpleSync {
let state = &self.chain.get_state();
//TODO: Paul to verify the logic of these fields.
HelloMessage {
network_id: self.network_id,
network_id: self.chain_id,
latest_finalized_root: state.finalized_root,
latest_finalized_epoch: state.finalized_epoch,
best_root: Hash256::zero(), //TODO: build correct value as a beacon chain function
@ -75,7 +75,7 @@ impl SimpleSync {
pub fn validate_peer(&mut self, peer_id: PeerId, hello_message: HelloMessage) -> bool {
// network id must match
if hello_message.network_id != self.network_id {
if hello_message.network_id != self.chain_id {
return false;
}
// compare latest epoch and finalized root to see if they exist in our chain

View File

@ -118,7 +118,7 @@ pub struct ChainSpec {
*
*/
pub boot_nodes: Vec<Multiaddr>,
pub network_id: u8,
pub chain_id: u8,
}
impl ChainSpec {
@ -255,7 +255,7 @@ impl ChainSpec {
* Boot nodes
*/
boot_nodes: vec![],
network_id: 1, // foundation network id
chain_id: 1, // foundation chain id
}
}
@ -272,7 +272,7 @@ impl ChainSpec {
Self {
boot_nodes,
network_id: 2, // lighthouse testnet network id
chain_id: 2, // lighthouse testnet chain id
..ChainSpec::few_validators()
}
}