mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Remove unnecessary alice
qualifiers in alice::SwapFactor
This commit is contained in:
parent
3bc76a91c6
commit
181999e04f
@ -93,7 +93,7 @@ async fn main() -> Result<()> {
|
|||||||
listen_addr,
|
listen_addr,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
let (swap, mut event_loop) = alice_factory.new_swap_as_alice(swap_amounts).await?;
|
let (swap, mut event_loop) = alice_factory.new_swap(swap_amounts).await?;
|
||||||
|
|
||||||
tokio::spawn(async move { event_loop.run().await });
|
tokio::spawn(async move { event_loop.run().await });
|
||||||
alice::run(swap).await?;
|
alice::run(swap).await?;
|
||||||
@ -181,7 +181,7 @@ async fn main() -> Result<()> {
|
|||||||
listen_addr,
|
listen_addr,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
let (swap, mut event_loop) = alice_factory.recover_alice_from_db().await?;
|
let (swap, mut event_loop) = alice_factory.resume().await?;
|
||||||
|
|
||||||
tokio::spawn(async move { event_loop.run().await });
|
tokio::spawn(async move { event_loop.run().await });
|
||||||
alice::run(swap).await?;
|
alice::run(swap).await?;
|
||||||
|
@ -96,7 +96,7 @@ impl SwapFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn new_swap_as_alice(&self, swap_amounts: SwapAmounts) -> Result<(Swap, EventLoop)> {
|
pub async fn new_swap(&self, swap_amounts: SwapAmounts) -> Result<(Swap, EventLoop)> {
|
||||||
let initial_state = init_alice_state(
|
let initial_state = init_alice_state(
|
||||||
swap_amounts.btc,
|
swap_amounts.btc,
|
||||||
swap_amounts.xmr,
|
swap_amounts.xmr,
|
||||||
@ -127,7 +127,7 @@ impl SwapFactory {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn recover_alice_from_db(&self) -> Result<(Swap, EventLoop)> {
|
pub async fn resume(&self) -> Result<(Swap, EventLoop)> {
|
||||||
// reopen the existing database
|
// reopen the existing database
|
||||||
let db = Database::open(self.db_path.clone().as_path())?;
|
let db = Database::open(self.db_path.clone().as_path())?;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ impl TestContext {
|
|||||||
pub async fn new_swap_as_alice(&self) -> alice::Swap {
|
pub async fn new_swap_as_alice(&self) -> alice::Swap {
|
||||||
let (swap, mut event_loop) = self
|
let (swap, mut event_loop) = self
|
||||||
.alice_swap_factory
|
.alice_swap_factory
|
||||||
.new_swap_as_alice(self.swap_amounts)
|
.new_swap(self.swap_amounts)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -52,11 +52,7 @@ impl TestContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn recover_alice_from_db(&self) -> alice::Swap {
|
pub async fn recover_alice_from_db(&self) -> alice::Swap {
|
||||||
let (swap, mut event_loop) = self
|
let (swap, mut event_loop) = self.alice_swap_factory.resume().await.unwrap();
|
||||||
.alice_swap_factory
|
|
||||||
.recover_alice_from_db()
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
tokio::spawn(async move { event_loop.run().await });
|
tokio::spawn(async move { event_loop.run().await });
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user