package tezos-base

  1. Overview
  2. Docs
type t = {
  1. chain_name : Distributed_db_version.Name.t;
  2. distributed_db_version : Distributed_db_version.t;
  3. p2p_version : P2p_version.t;
}
val pp : Format.formatter -> t -> unit
val encoding : t Data_encoding.t
val announced : chain_name:Distributed_db_version.Name.t -> distributed_db_versions:Distributed_db_version.t list -> p2p_versions:P2p_version.t list -> t

Get the network protocol version to announce on peer connection.

Use the highest distributed_db_versions and the highest p2p_versions. The version also contains the chain_name since it is used to prevent peers from different networks to communicate.

Neither distributed_db_versions nor p2p_versions can be empty.

val select : chain_name:Distributed_db_version.Name.t -> distributed_db_versions:Distributed_db_version.t list -> p2p_versions:P2p_version.t list -> t -> t Tezos_error_monad.Error_monad.tzresult

Try to find a version which is supported both by us and a peer.

Usage: select ~chain_name ~distributed_db_versions ~p2p_versions remote_version

If the chain name of remote_version is not equal to chain_name, there is no compatible version.

distributed_db_versions is the list of distributed database versions supported by the node. If the highest supported version is lesser or equal to the remote version, use this highest supported version. Otherwise, there is no compatible version.

Similarly, p2p_versions is the list of peer-to-peer versions supported by the node. The rules to find a compatible version are the same as the ones for distributed_db_versions.

If there is no compatible version, return a P2p_rejection.Rejecting error.

OCaml

Innovation. Community. Security.