Skip to main content

to_peer_id

Function to_peer_id 

Source
pub fn to_peer_id(node_index: NodeIndex) -> Option<PeerId>
Expand description

Convert an aleph-bft NodeIndex into a PeerId, if it can represent one.

NodeIndex wraps a usize and its decoder accepts any u64 verbatim, so every index embedded in a message received from a peer is chosen by that peer and may not correspond to any peer at all. Callers have to handle None instead of panicking, since a panic in the consensus task shuts down the entire node.