mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-07 05:52:31 -04:00
Merge #99
99: Cleanup resume_from_database functions only used in tests r=da-kami a=da-kami Follow up of https://github.com/comit-network/xmr-btc-swap/pull/88 Co-authored-by: Daniel Karzel <daniel@comit.network>
This commit is contained in:
commit
3db71997d3
4 changed files with 14 additions and 53 deletions
|
@ -233,29 +233,6 @@ pub async fn swap(
|
|||
.await
|
||||
}
|
||||
|
||||
pub async fn resume_from_database(
|
||||
event_loop_handle: EventLoopHandle,
|
||||
bitcoin_wallet: Arc<crate::bitcoin::Wallet>,
|
||||
monero_wallet: Arc<crate::monero::Wallet>,
|
||||
config: Config,
|
||||
swap_id: Uuid,
|
||||
db: Database,
|
||||
) -> Result<AliceState> {
|
||||
let db_swap = db.get_state(swap_id)?;
|
||||
let start_state = AliceState::try_from(db_swap)?;
|
||||
let state = swap(
|
||||
start_state,
|
||||
event_loop_handle,
|
||||
bitcoin_wallet,
|
||||
monero_wallet,
|
||||
config,
|
||||
swap_id,
|
||||
db,
|
||||
)
|
||||
.await?;
|
||||
Ok(state)
|
||||
}
|
||||
|
||||
pub fn is_complete(state: &AliceState) -> bool {
|
||||
matches!(
|
||||
state,
|
||||
|
|
|
@ -127,32 +127,6 @@ where
|
|||
.await
|
||||
}
|
||||
|
||||
pub async fn resume_from_database<R>(
|
||||
event_loop_handle: EventLoopHandle,
|
||||
db: Database,
|
||||
bitcoin_wallet: Arc<crate::bitcoin::Wallet>,
|
||||
monero_wallet: Arc<crate::monero::Wallet>,
|
||||
rng: R,
|
||||
swap_id: Uuid,
|
||||
) -> Result<BobState>
|
||||
where
|
||||
R: RngCore + CryptoRng + Send,
|
||||
{
|
||||
let db_swap = db.get_state(swap_id)?;
|
||||
let start_state = BobState::try_from(db_swap)?;
|
||||
let state = swap(
|
||||
start_state,
|
||||
event_loop_handle,
|
||||
db,
|
||||
bitcoin_wallet,
|
||||
monero_wallet,
|
||||
rng,
|
||||
swap_id,
|
||||
)
|
||||
.await?;
|
||||
Ok(state)
|
||||
}
|
||||
|
||||
pub fn is_complete(state: &BobState) -> bool {
|
||||
matches!(
|
||||
state,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue