Deterministic peer id from seed for bob

This commit is contained in:
Daniel Karzel 2021-01-08 13:27:56 +11:00
parent 0a21040e08
commit f18d01dfaf
3 changed files with 21 additions and 3 deletions

View file

@ -192,7 +192,8 @@ pub fn init_bob_event_loop(
alice_peer_id: PeerId,
alice_addr: Multiaddr,
) -> (bob::event_loop::EventLoop, bob::event_loop::EventLoopHandle) {
let bob_behaviour = bob::Behaviour::default();
let seed = Seed::random().unwrap();
let bob_behaviour = bob::Behaviour::new(network::Seed::new(seed.bytes()));
let bob_transport = build(bob_behaviour.identity()).unwrap();
bob::event_loop::EventLoop::new(bob_transport, bob_behaviour, alice_peer_id, alice_addr)
.unwrap()