Remove unnecessary alice qualifiers in alice::SwapFactor

This commit is contained in:
Franck Royer 2021-01-19 14:40:48 +11:00
parent 3bc76a91c6
commit 181999e04f
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
3 changed files with 6 additions and 10 deletions

View File

@ -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?;

View File

@ -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())?;

View File

@ -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 });