Unverified Commit beab04f9 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Make sure validator discovery works with a delayed peer to validator mapping (#1886)



* Make sure validator discovery works with a delayed peer to validator mapping

Currently the implementation checks on connect of a peer if this peer is
a validator by asking the authority discovery. It can now happen that
the authority discovery is not yet aware that a given peer is an
authority. This can for example happen on start up of the node.

This pr changes the behavior, to make it possible to later associate a
peer to a validator id. Instead of just storing the connected
validators, we now store all connected peers with a vector of associated
validator ids. When we get a request to connect to a given given set of
validators, we start by checking the connected peers. If we didn't find
a validator id in the connected peers, we ask the authority discovery
for the peerid of a given authority id. When the returned peerid is part
of our connected peers set, we cache and return the authority id.

* Update node/network/bridge/Cargo.toml

Co-authored-by: default avatarPierre Krieger <[email protected]>

* Update node/network/bridge/src/validator_discovery.rs

Co-authored-by: default avatarPierre Krieger <[email protected]>

* Update `Cargo.lock`

Co-authored-by: default avatarPierre Krieger <[email protected]>
parent f6f8a422
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment