mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-01-13 00:19:31 -05:00
Rename do_run_until to _run_until_internal
This commit is contained in:
parent
82974412b2
commit
170e90ffed
@ -72,7 +72,7 @@ pub async fn run_until(
|
|||||||
swap: alice::Swap,
|
swap: alice::Swap,
|
||||||
is_target_state: fn(&AliceState) -> bool,
|
is_target_state: fn(&AliceState) -> bool,
|
||||||
) -> Result<AliceState> {
|
) -> Result<AliceState> {
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
swap.state,
|
swap.state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
swap.event_loop_handle,
|
swap.event_loop_handle,
|
||||||
@ -88,7 +88,7 @@ pub async fn run_until(
|
|||||||
// State machine driver for swap execution
|
// State machine driver for swap execution
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
async fn do_run_until(
|
async fn run_until_internal(
|
||||||
state: AliceState,
|
state: AliceState,
|
||||||
is_target_state: fn(&AliceState) -> bool,
|
is_target_state: fn(&AliceState) -> bool,
|
||||||
mut event_loop_handle: EventLoopHandle,
|
mut event_loop_handle: EventLoopHandle,
|
||||||
@ -116,7 +116,7 @@ async fn do_run_until(
|
|||||||
let db_state = (&state).into();
|
let db_state = (&state).into();
|
||||||
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
||||||
.await?;
|
.await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -159,7 +159,7 @@ async fn do_run_until(
|
|||||||
let db_state = (&state).into();
|
let db_state = (&state).into();
|
||||||
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
||||||
.await?;
|
.await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -200,7 +200,7 @@ async fn do_run_until(
|
|||||||
let db_state = (&state).into();
|
let db_state = (&state).into();
|
||||||
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
||||||
.await?;
|
.await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -238,7 +238,7 @@ async fn do_run_until(
|
|||||||
let db_state = (&state).into();
|
let db_state = (&state).into();
|
||||||
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
||||||
.await?;
|
.await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -276,7 +276,7 @@ async fn do_run_until(
|
|||||||
let db_state = (&state).into();
|
let db_state = (&state).into();
|
||||||
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
||||||
.await?;
|
.await?;
|
||||||
return do_run_until(
|
return run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -304,7 +304,7 @@ async fn do_run_until(
|
|||||||
let db_state = (&state).into();
|
let db_state = (&state).into();
|
||||||
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
||||||
.await?;
|
.await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -331,7 +331,7 @@ async fn do_run_until(
|
|||||||
let db_state = (&state).into();
|
let db_state = (&state).into();
|
||||||
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
||||||
.await?;
|
.await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -365,7 +365,7 @@ async fn do_run_until(
|
|||||||
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -390,7 +390,7 @@ async fn do_run_until(
|
|||||||
let db_state = (&state).into();
|
let db_state = (&state).into();
|
||||||
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
||||||
.await?;
|
.await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -445,7 +445,7 @@ async fn do_run_until(
|
|||||||
let db_state = (&state).into();
|
let db_state = (&state).into();
|
||||||
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
||||||
.await?;
|
.await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -469,7 +469,7 @@ async fn do_run_until(
|
|||||||
let db_state = (&state).into();
|
let db_state = (&state).into();
|
||||||
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
db.insert_latest_state(swap_id, database::Swap::Alice(db_state))
|
||||||
.await?;
|
.await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
|
@ -46,7 +46,7 @@ pub async fn run_until(
|
|||||||
swap: bob::Swap,
|
swap: bob::Swap,
|
||||||
is_target_state: fn(&BobState) -> bool,
|
is_target_state: fn(&BobState) -> bool,
|
||||||
) -> Result<BobState> {
|
) -> Result<BobState> {
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
swap.state,
|
swap.state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
swap.event_loop_handle,
|
swap.event_loop_handle,
|
||||||
@ -62,7 +62,7 @@ pub async fn run_until(
|
|||||||
// State machine driver for swap execution
|
// State machine driver for swap execution
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
#[async_recursion]
|
#[async_recursion]
|
||||||
async fn do_run_until<R>(
|
async fn run_until_internal<R>(
|
||||||
state: BobState,
|
state: BobState,
|
||||||
is_target_state: fn(&BobState) -> bool,
|
is_target_state: fn(&BobState) -> bool,
|
||||||
mut event_loop_handle: EventLoopHandle,
|
mut event_loop_handle: EventLoopHandle,
|
||||||
@ -95,7 +95,7 @@ where
|
|||||||
let state = BobState::Negotiated(state2);
|
let state = BobState::Negotiated(state2);
|
||||||
let db_state = state.clone().into();
|
let db_state = state.clone().into();
|
||||||
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -116,7 +116,7 @@ where
|
|||||||
let state = BobState::BtcLocked(state3);
|
let state = BobState::BtcLocked(state3);
|
||||||
let db_state = state.clone().into();
|
let db_state = state.clone().into();
|
||||||
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -181,7 +181,7 @@ where
|
|||||||
};
|
};
|
||||||
let db_state = state.clone().into();
|
let db_state = state.clone().into();
|
||||||
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -222,7 +222,7 @@ where
|
|||||||
};
|
};
|
||||||
let db_state = state.clone().into();
|
let db_state = state.clone().into();
|
||||||
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -257,7 +257,7 @@ where
|
|||||||
|
|
||||||
let db_state = state.clone().into();
|
let db_state = state.clone().into();
|
||||||
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -278,7 +278,7 @@ where
|
|||||||
};
|
};
|
||||||
let db_state = state.clone().into();
|
let db_state = state.clone().into();
|
||||||
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -303,7 +303,7 @@ where
|
|||||||
db.insert_latest_state(swap_id, Swap::Bob(state.clone().into()))
|
db.insert_latest_state(swap_id, Swap::Bob(state.clone().into()))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
@ -332,7 +332,7 @@ where
|
|||||||
|
|
||||||
let db_state = state.clone().into();
|
let db_state = state.clone().into();
|
||||||
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
||||||
do_run_until(
|
run_until_internal(
|
||||||
state,
|
state,
|
||||||
is_target_state,
|
is_target_state,
|
||||||
event_loop_handle,
|
event_loop_handle,
|
||||||
|
Loading…
Reference in New Issue
Block a user