diff --git a/swap/src/main.rs b/swap/src/main.rs index 182febd5..7a1bfc22 100644 --- a/swap/src/main.rs +++ b/swap/src/main.rs @@ -93,7 +93,7 @@ async fn main() -> Result<()> { listen_addr, ) .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 }); alice::run(swap).await?; @@ -181,7 +181,7 @@ async fn main() -> Result<()> { listen_addr, ) .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 }); alice::run(swap).await?; diff --git a/swap/src/protocol/alice.rs b/swap/src/protocol/alice.rs index 3b07005b..4d2a734e 100644 --- a/swap/src/protocol/alice.rs +++ b/swap/src/protocol/alice.rs @@ -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( swap_amounts.btc, 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 let db = Database::open(self.db_path.clone().as_path())?; diff --git a/swap/tests/testutils/mod.rs b/swap/tests/testutils/mod.rs index ce4d0102..185abf33 100644 --- a/swap/tests/testutils/mod.rs +++ b/swap/tests/testutils/mod.rs @@ -30,7 +30,7 @@ impl TestContext { pub async fn new_swap_as_alice(&self) -> alice::Swap { let (swap, mut event_loop) = self .alice_swap_factory - .new_swap_as_alice(self.swap_amounts) + .new_swap(self.swap_amounts) .await .unwrap(); @@ -52,11 +52,7 @@ impl TestContext { } pub async fn recover_alice_from_db(&self) -> alice::Swap { - let (swap, mut event_loop) = self - .alice_swap_factory - .recover_alice_from_db() - .await - .unwrap(); + let (swap, mut event_loop) = self.alice_swap_factory.resume().await.unwrap(); tokio::spawn(async move { event_loop.run().await });