mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Rename swarm constructors to be per tool instead of per role
This commit is contained in:
parent
d19231d811
commit
90deb6451c
@ -147,7 +147,7 @@ async fn main() -> Result<()> {
|
|||||||
let current_balance = monero_wallet.get_balance().await?;
|
let current_balance = monero_wallet.get_balance().await?;
|
||||||
let lock_fee = monero_wallet.static_tx_fee_estimate();
|
let lock_fee = monero_wallet.static_tx_fee_estimate();
|
||||||
let kraken_rate = KrakenRate::new(config.maker.ask_spread, kraken_price_updates);
|
let kraken_rate = KrakenRate::new(config.maker.ask_spread, kraken_price_updates);
|
||||||
let mut swarm = swarm::alice(
|
let mut swarm = swarm::asb(
|
||||||
&seed,
|
&seed,
|
||||||
current_balance,
|
current_balance,
|
||||||
lock_fee,
|
lock_fee,
|
||||||
|
@ -85,7 +85,7 @@ async fn main() -> Result<()> {
|
|||||||
init_monero_wallet(data_dir, monero_daemon_address, env_config).await?;
|
init_monero_wallet(data_dir, monero_daemon_address, env_config).await?;
|
||||||
let bitcoin_wallet = Arc::new(bitcoin_wallet);
|
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
|
swarm
|
||||||
.behaviour_mut()
|
.behaviour_mut()
|
||||||
.add_address(seller_peer_id, seller_addr);
|
.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 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();
|
let our_peer_id = swarm.local_peer_id();
|
||||||
tracing::debug!(peer_id = %our_peer_id, "Initializing network module");
|
tracing::debug!(peer_id = %our_peer_id, "Initializing network module");
|
||||||
swarm
|
swarm
|
||||||
|
@ -9,7 +9,7 @@ use libp2p::{PeerId, Swarm};
|
|||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn alice<LR>(
|
pub fn asb<LR>(
|
||||||
seed: &Seed,
|
seed: &Seed,
|
||||||
balance: monero::Amount,
|
balance: monero::Amount,
|
||||||
lock_fee: monero::Amount,
|
lock_fee: monero::Amount,
|
||||||
@ -36,7 +36,7 @@ where
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn bob(
|
pub async fn cli(
|
||||||
seed: &Seed,
|
seed: &Seed,
|
||||||
alice: PeerId,
|
alice: PeerId,
|
||||||
tor_socks5_port: u16,
|
tor_socks5_port: u16,
|
||||||
|
@ -231,7 +231,7 @@ async fn start_alice(
|
|||||||
let latest_rate = FixedRate::default();
|
let latest_rate = FixedRate::default();
|
||||||
let resume_only = false;
|
let resume_only = false;
|
||||||
|
|
||||||
let mut swarm = swarm::alice(
|
let mut swarm = swarm::asb(
|
||||||
&seed,
|
&seed,
|
||||||
current_balance,
|
current_balance,
|
||||||
lock_fee,
|
lock_fee,
|
||||||
@ -449,7 +449,7 @@ impl BobParams {
|
|||||||
) -> Result<(bob::EventLoop, bob::EventLoopHandle)> {
|
) -> Result<(bob::EventLoop, bob::EventLoopHandle)> {
|
||||||
let tor_socks5_port = get_port()
|
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.");
|
.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
|
swarm
|
||||||
.behaviour_mut()
|
.behaviour_mut()
|
||||||
.add_address(self.alice_peer_id, self.alice_address.clone());
|
.add_address(self.alice_peer_id, self.alice_address.clone());
|
||||||
|
Loading…
Reference in New Issue
Block a user