Skip to content

Commit

Permalink
Remove unused code and update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmygchen committed Jul 2, 2024
1 parent bf70fb4 commit ac981a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 30 deletions.
30 changes: 0 additions & 30 deletions beacon_node/lighthouse_network/src/peer_manager/peerdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,36 +704,6 @@ impl<E: EthSpec> PeerDB<E> {
)
}

/// Updates the connection state. MUST ONLY BE USED IN TESTS.
#[cfg(test)]
pub(crate) fn __add_connected_peer_enr_testing_only(
&mut self,
enr: Enr,
) -> Option<BanOperation> {
let peer_id = enr.peer_id();
let new_state = NewConnectionState::Connected {
enr: Some(enr),
seen_address: Multiaddr::empty(),
direction: ConnectionDirection::Outgoing,
};
self.update_connection_state(&peer_id, new_state)
}

/// Updates the connection state. MUST ONLY BE USED IN TESTS.
#[cfg(test)]
pub(crate) fn __add_connected_peer_multiaddr_testing_only(
&mut self,
peer_id: &PeerId,
multiaddr: Multiaddr,
) -> Option<BanOperation> {
let new_state = NewConnectionState::Connected {
enr: None,
seen_address: multiaddr,
direction: ConnectionDirection::Outgoing,
};
self.update_connection_state(peer_id, new_state)
}

/// The connection state of the peer has been changed. Modify the peer in the db to ensure all
/// variables are in sync with libp2p.
/// Updating the state can lead to a `BanOperation` which needs to be processed via the peer
Expand Down
6 changes: 6 additions & 0 deletions beacon_node/lighthouse_network/src/types/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ impl<E: EthSpec> NetworkGlobals<E> {
DataColumnSubnetId::compute_custody_subnets::<E>(node_id, custody_subnet_count, spec)
}

/// Returns a connected peer that:
/// 1. is connected
/// 2. assigned to custody the column based on it's `custody_subnet_count` from metadata (WIP)
/// 3. has a good score
/// 4. subscribed to the specified column - this condition can be removed later, so we can
/// identify and penalise peers that are supposed to custody the column.
pub fn custody_peers_for_column(
&self,
column_index: ColumnIndex,
Expand Down

0 comments on commit ac981a0

Please sign in to comment.