reth_eth_wire::capability

Function shared_capability_offsets

Source
pub fn shared_capability_offsets(
    local_protocols: Vec<Protocol>,
    peer_capabilities: Vec<Capability>,
) -> Result<Vec<SharedCapability>, P2PStreamError>
Expand description

Determines the offsets for each shared capability between the input list of peer capabilities and the input list of locally supported Protocol.

Additionally, the p2p capability version 5 is supported, but is expected not to be in neither local_protocols or peer_capabilities.

Note: For local_protocols this takes Protocol because we need to know the number of messages per versioned capability. From the remote we only get the plain Capability.