mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-02 03:26:23 -04:00
Move run_until is_target_state comparison functions into testutils
This commit is contained in:
parent
3593f5323a
commit
33a9057b1f
10 changed files with 55 additions and 53 deletions
|
@ -460,3 +460,41 @@ fn init_tracing() -> DefaultGuard {
|
|||
))
|
||||
.set_default()
|
||||
}
|
||||
|
||||
pub mod alice_run_until {
|
||||
use swap::protocol::alice::AliceState;
|
||||
|
||||
pub fn is_xmr_locked(state: &AliceState) -> bool {
|
||||
matches!(
|
||||
state,
|
||||
AliceState::XmrLocked{..}
|
||||
)
|
||||
}
|
||||
|
||||
pub fn is_encsig_learned(state: &AliceState) -> bool {
|
||||
matches!(
|
||||
state,
|
||||
AliceState::EncSigLearned{..}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub mod bob_run_until {
|
||||
use swap::protocol::bob::BobState;
|
||||
|
||||
pub fn is_btc_locked(state: &BobState) -> bool {
|
||||
matches!(state, BobState::BtcLocked(..))
|
||||
}
|
||||
|
||||
pub fn is_lock_proof_received(state: &BobState) -> bool {
|
||||
matches!(state, BobState::XmrLockProofReceived { .. })
|
||||
}
|
||||
|
||||
pub fn is_xmr_locked(state: &BobState) -> bool {
|
||||
matches!(state, BobState::XmrLocked(..))
|
||||
}
|
||||
|
||||
pub fn is_encsig_sent(state: &BobState) -> bool {
|
||||
matches!(state, BobState::EncSigSent(..))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue