Refactor Alice's peer-id and identity to be handled on the outside

Doing this in the behaviour is a weird indirection that is not needed.
This commit is contained in:
Daniel Karzel 2021-01-18 20:33:10 +11:00
parent 8bf467b550
commit 0c19af9090
4 changed files with 31 additions and 70 deletions

View file

@ -666,9 +666,13 @@ fn init_alice_event_loop(
alice::event_loop::EventLoop,
alice::event_loop::EventLoopHandle,
) {
let alice_behaviour = alice::Behaviour::new(network::Seed::new(seed));
let alice_transport = build(alice_behaviour.identity()).unwrap();
alice::event_loop::EventLoop::new(alice_transport, alice_behaviour, listen).unwrap()
let identity = network::Seed::new(seed).derive_libp2p_identity();
let peer_id = identity.public().into_peer_id();
let alice_behaviour = alice::Behaviour::default();
let alice_transport = build(identity).unwrap();
alice::event_loop::EventLoop::new(alice_transport, alice_behaviour, listen, peer_id).unwrap()
}
async fn init_bob_state(