Don't qualify with alice:: if we are within a module of Alice

This commit is contained in:
Thomas Eizinger 2021-04-16 11:17:13 +10:00
parent a31d6febca
commit 5b515d6fb2
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

View File

@ -2,9 +2,8 @@
//! Alice holds XMR and wishes receive BTC. //! Alice holds XMR and wishes receive BTC.
use crate::bitcoin::ExpiredTimelocks; use crate::bitcoin::ExpiredTimelocks;
use crate::env::Config; use crate::env::Config;
use crate::protocol::alice;
use crate::protocol::alice::event_loop::EventLoopHandle; use crate::protocol::alice::event_loop::EventLoopHandle;
use crate::protocol::alice::AliceState; use crate::protocol::alice::{AliceState, Swap};
use crate::{bitcoin, database, monero}; use crate::{bitcoin, database, monero};
use anyhow::{bail, Context, Result}; use anyhow::{bail, Context, Result};
use tokio::select; use tokio::select;
@ -12,15 +11,12 @@ use tokio::time::timeout;
use tracing::{error, info}; use tracing::{error, info};
use uuid::Uuid; use uuid::Uuid;
pub async fn run(swap: alice::Swap) -> Result<AliceState> { pub async fn run(swap: Swap) -> Result<AliceState> {
run_until(swap, |_| false).await run_until(swap, |_| false).await
} }
#[tracing::instrument(name = "swap", skip(swap,exit_early), fields(id = %swap.swap_id), err)] #[tracing::instrument(name = "swap", skip(swap,exit_early), fields(id = %swap.swap_id), err)]
pub async fn run_until( pub async fn run_until(mut swap: Swap, exit_early: fn(&AliceState) -> bool) -> Result<AliceState> {
mut swap: alice::Swap,
exit_early: fn(&AliceState) -> bool,
) -> Result<AliceState> {
let mut current_state = swap.state; let mut current_state = swap.state;
while !is_complete(&current_state) && !exit_early(&current_state) { while !is_complete(&current_state) && !exit_early(&current_state) {