Pass in CLI behaviour when creating swarm

This allows us to reuse the swarm setup with a different behaviour for discovering ASBs with a rendezvous node.
This commit is contained in:
Daniel Karzel 2021-06-28 20:49:02 +10:00
parent 2e3601693e
commit 4ffb2f14be
No known key found for this signature in database
GPG key ID: 30C3FC2E438ADB6E
3 changed files with 22 additions and 31 deletions

View file

@ -445,12 +445,16 @@ impl BobParams {
) -> Result<(cli::EventLoop, cli::EventLoopHandle)> {
let tor_socks5_port = get_port()
.expect("We don't care about Tor in the tests so we get a free port to disable it.");
let mut swarm = swarm::cli(
&self.seed,
let behaviour = cli::Behaviour::new(
self.alice_peer_id,
tor_socks5_port,
self.env_config,
self.bitcoin_wallet.clone(),
);
let mut swarm = swarm::cli(
self.seed.derive_libp2p_identity(),
tor_socks5_port,
behaviour,
)
.await?;
swarm