package octez-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=55ea1fb8bb3273a7fc270ca8f650d45c56449665619482aad9bc12f3ea736b7e
sha512=fec850fc2d17d7490bbabd5147d62aad13b3aaed8774270f8a38ab419670ed03e0fd30cf8642a97984eca5c2446726fe590ad99c015f7ec50919dc7652f25053
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.