package octez-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=c6df840ebbf115e454db949028c595bec558a59a66cade73b52a6d099d6fa4d4
sha512=d8aee903b9fe130d73176bc8ec38b78c9ff65317da3cb4f3415f09af0c625b4384e7498201fdb61aa39086a7d5d409d0ab3423f9bc3ab989a680cf444a79bc13
doc/octez-libs.base/Tezos_base/Network_version/index.html
Module Tezos_base.Network_version
Source
type t = {
chain_name : Distributed_db_version.Name.t;
distributed_db_version : Distributed_db_version.t;
p2p_version : P2p_version.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.