Rename swarm constructors to be per tool instead of per role

pull/558/head
Thomas Eizinger 3 years ago
parent d19231d811
commit 90deb6451c
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

@ -147,7 +147,7 @@ async fn main() -> Result<()> {
let current_balance = monero_wallet.get_balance().await?;
let lock_fee = monero_wallet.static_tx_fee_estimate();
let kraken_rate = KrakenRate::new(config.maker.ask_spread, kraken_price_updates);
let mut swarm = swarm::alice(
let mut swarm = swarm::asb(
&seed,
current_balance,
lock_fee,

@ -85,7 +85,7 @@ async fn main() -> Result<()> {
init_monero_wallet(data_dir, monero_daemon_address, env_config).await?;
let bitcoin_wallet = Arc::new(bitcoin_wallet);
let mut swarm = swarm::bob(&seed, seller_peer_id, tor_socks5_port).await?;
let mut swarm = swarm::cli(&seed, seller_peer_id, tor_socks5_port).await?;
swarm
.behaviour_mut()
.add_address(seller_peer_id, seller_addr);
@ -185,7 +185,7 @@ async fn main() -> Result<()> {
let seller_peer_id = db.get_peer_id(swap_id)?;
let mut swarm = swarm::bob(&seed, seller_peer_id, tor_socks5_port).await?;
let mut swarm = swarm::cli(&seed, seller_peer_id, tor_socks5_port).await?;
let our_peer_id = swarm.local_peer_id();
tracing::debug!(peer_id = %our_peer_id, "Initializing network module");
swarm

@ -9,7 +9,7 @@ use libp2p::{PeerId, Swarm};
use std::fmt::Debug;
#[allow(clippy::too_many_arguments)]
pub fn alice<LR>(
pub fn asb<LR>(
seed: &Seed,
balance: monero::Amount,
lock_fee: monero::Amount,
@ -36,7 +36,7 @@ where
)
}
pub async fn bob(
pub async fn cli(
seed: &Seed,
alice: PeerId,
tor_socks5_port: u16,

@ -231,7 +231,7 @@ async fn start_alice(
let latest_rate = FixedRate::default();
let resume_only = false;
let mut swarm = swarm::alice(
let mut swarm = swarm::asb(
&seed,
current_balance,
lock_fee,
@ -449,7 +449,7 @@ impl BobParams {
) -> Result<(bob::EventLoop, bob::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::bob(&self.seed, self.alice_peer_id, tor_socks5_port).await?;
let mut swarm = swarm::cli(&self.seed, self.alice_peer_id, tor_socks5_port).await?;
swarm
.behaviour_mut()
.add_address(self.alice_peer_id, self.alice_address.clone());

Loading…
Cancel
Save