2020-11-12 00:06:34 +00:00
|
|
|
use crate::{
|
2020-12-14 07:25:46 +00:00
|
|
|
bob::{event_loop::EventLoopHandle, negotiate::negotiate},
|
2020-12-08 03:54:08 +00:00
|
|
|
state,
|
2020-12-14 10:15:52 +00:00
|
|
|
state::{Bob, Swap},
|
2020-11-12 00:06:34 +00:00
|
|
|
storage::Database,
|
2020-11-30 02:25:11 +00:00
|
|
|
SwapAmounts,
|
2020-11-12 00:06:34 +00:00
|
|
|
};
|
2020-12-14 10:15:52 +00:00
|
|
|
use anyhow::{bail, Result};
|
2020-11-12 00:06:34 +00:00
|
|
|
use async_recursion::async_recursion;
|
2020-12-01 03:30:02 +00:00
|
|
|
use libp2p::{core::Multiaddr, PeerId};
|
2020-11-30 02:25:11 +00:00
|
|
|
use rand::{CryptoRng, RngCore};
|
2020-12-14 10:15:52 +00:00
|
|
|
use std::{convert::TryFrom, fmt, sync::Arc};
|
2020-12-07 02:31:14 +00:00
|
|
|
use tracing::info;
|
2020-11-12 00:06:34 +00:00
|
|
|
use uuid::Uuid;
|
2020-12-11 05:49:19 +00:00
|
|
|
use xmr_btc::{
|
|
|
|
bob::{self},
|
|
|
|
Epoch,
|
|
|
|
};
|
2020-11-12 00:06:34 +00:00
|
|
|
|
|
|
|
// The same data structure is used for swap execution and recovery.
|
|
|
|
// This allows for a seamless transition from a failed swap to recovery.
|
2020-12-08 03:54:08 +00:00
|
|
|
#[derive(Debug, Clone)]
|
2020-11-12 00:06:34 +00:00
|
|
|
pub enum BobState {
|
2020-11-30 02:25:11 +00:00
|
|
|
Started {
|
|
|
|
state0: bob::State0,
|
|
|
|
amounts: SwapAmounts,
|
2020-12-01 03:30:02 +00:00
|
|
|
addr: Multiaddr,
|
2020-11-30 02:25:11 +00:00
|
|
|
},
|
2020-11-12 00:06:34 +00:00
|
|
|
Negotiated(bob::State2, PeerId),
|
|
|
|
BtcLocked(bob::State3, PeerId),
|
|
|
|
XmrLocked(bob::State4, PeerId),
|
|
|
|
EncSigSent(bob::State4, PeerId),
|
|
|
|
BtcRedeemed(bob::State5),
|
|
|
|
Cancelled(bob::State4),
|
2020-12-11 05:49:19 +00:00
|
|
|
BtcRefunded(bob::State4),
|
2020-11-12 00:06:34 +00:00
|
|
|
XmrRedeemed,
|
|
|
|
Punished,
|
|
|
|
SafelyAborted,
|
|
|
|
}
|
|
|
|
|
2020-12-02 01:36:47 +00:00
|
|
|
impl fmt::Display for BobState {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
match self {
|
|
|
|
BobState::Started { .. } => write!(f, "started"),
|
|
|
|
BobState::Negotiated(..) => write!(f, "negotiated"),
|
|
|
|
BobState::BtcLocked(..) => write!(f, "btc_locked"),
|
|
|
|
BobState::XmrLocked(..) => write!(f, "xmr_locked"),
|
|
|
|
BobState::EncSigSent(..) => write!(f, "encsig_sent"),
|
2020-12-11 05:49:19 +00:00
|
|
|
BobState::BtcRedeemed(..) => write!(f, "btc_redeemed"),
|
|
|
|
BobState::Cancelled(..) => write!(f, "cancelled"),
|
|
|
|
BobState::BtcRefunded(..) => write!(f, "btc_refunded"),
|
2020-12-02 01:36:47 +00:00
|
|
|
BobState::XmrRedeemed => write!(f, "xmr_redeemed"),
|
|
|
|
BobState::Punished => write!(f, "punished"),
|
|
|
|
BobState::SafelyAborted => write!(f, "safely_aborted"),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-08 03:54:08 +00:00
|
|
|
impl From<BobState> for state::Bob {
|
|
|
|
fn from(bob_state: BobState) -> Self {
|
|
|
|
match bob_state {
|
2020-12-14 07:25:46 +00:00
|
|
|
BobState::Started { .. } => {
|
|
|
|
// TODO: Do we want to resume just started swaps
|
|
|
|
unimplemented!("Cannot save a swap that has just started")
|
|
|
|
}
|
2020-12-08 03:54:08 +00:00
|
|
|
BobState::Negotiated(state2, peer_id) => Bob::Negotiated { state2, peer_id },
|
|
|
|
BobState::BtcLocked(state3, peer_id) => Bob::BtcLocked { state3, peer_id },
|
|
|
|
BobState::XmrLocked(state4, peer_id) => Bob::XmrLocked { state4, peer_id },
|
|
|
|
BobState::EncSigSent(state4, peer_id) => Bob::EncSigSent { state4, peer_id },
|
|
|
|
BobState::BtcRedeemed(state5) => Bob::BtcRedeemed(state5),
|
|
|
|
BobState::Cancelled(state4) => Bob::BtcCancelled(state4),
|
|
|
|
BobState::BtcRefunded(_)
|
|
|
|
| BobState::XmrRedeemed
|
|
|
|
| BobState::Punished
|
|
|
|
| BobState::SafelyAborted => Bob::SwapComplete,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-14 10:15:52 +00:00
|
|
|
impl TryFrom<state::Swap> for BobState {
|
|
|
|
type Error = anyhow::Error;
|
|
|
|
|
|
|
|
fn try_from(db_state: state::Swap) -> Result<Self, Self::Error> {
|
|
|
|
if let Swap::Bob(state) = db_state {
|
|
|
|
let bob_State = match state {
|
|
|
|
Bob::Negotiated { state2, peer_id } => BobState::Negotiated(state2, peer_id),
|
|
|
|
Bob::BtcLocked { state3, peer_id } => BobState::BtcLocked(state3, peer_id),
|
|
|
|
Bob::XmrLocked { state4, peer_id } => BobState::XmrLocked(state4, peer_id),
|
|
|
|
Bob::EncSigSent { state4, peer_id } => BobState::EncSigSent(state4, peer_id),
|
|
|
|
Bob::BtcRedeemed(state5) => BobState::BtcRedeemed(state5),
|
|
|
|
Bob::BtcCancelled(state4) => BobState::Cancelled(state4),
|
|
|
|
Bob::SwapComplete => BobState::SafelyAborted,
|
|
|
|
};
|
|
|
|
|
|
|
|
Ok(bob_State)
|
|
|
|
} else {
|
|
|
|
bail!("Bob swap state expected.")
|
2020-12-08 05:47:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-02 01:09:43 +00:00
|
|
|
pub async fn swap<R>(
|
|
|
|
state: BobState,
|
2020-12-10 02:55:29 +00:00
|
|
|
event_loop_handle: EventLoopHandle,
|
2020-12-02 01:09:43 +00:00
|
|
|
db: Database,
|
|
|
|
bitcoin_wallet: Arc<crate::bitcoin::Wallet>,
|
|
|
|
monero_wallet: Arc<crate::monero::Wallet>,
|
|
|
|
rng: R,
|
|
|
|
swap_id: Uuid,
|
|
|
|
) -> Result<BobState>
|
2020-12-02 01:36:47 +00:00
|
|
|
where
|
|
|
|
R: RngCore + CryptoRng + Send,
|
2020-12-02 01:09:43 +00:00
|
|
|
{
|
2020-12-02 01:36:47 +00:00
|
|
|
run_until(
|
|
|
|
state,
|
|
|
|
is_complete,
|
2020-12-10 02:55:29 +00:00
|
|
|
event_loop_handle,
|
2020-12-02 01:36:47 +00:00
|
|
|
db,
|
|
|
|
bitcoin_wallet,
|
|
|
|
monero_wallet,
|
|
|
|
rng,
|
|
|
|
swap_id,
|
|
|
|
)
|
|
|
|
.await
|
2020-12-02 01:09:43 +00:00
|
|
|
}
|
|
|
|
|
2020-12-14 10:15:52 +00:00
|
|
|
pub async fn recover<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)
|
|
|
|
}
|
|
|
|
|
2020-12-02 01:09:43 +00:00
|
|
|
pub fn is_complete(state: &BobState) -> bool {
|
2020-12-02 01:36:47 +00:00
|
|
|
matches!(
|
|
|
|
state,
|
2020-12-11 05:49:19 +00:00
|
|
|
BobState::BtcRefunded(..)
|
2020-12-02 01:36:47 +00:00
|
|
|
| BobState::XmrRedeemed
|
|
|
|
| BobState::Punished
|
|
|
|
| BobState::SafelyAborted
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn is_btc_locked(state: &BobState) -> bool {
|
|
|
|
matches!(state, BobState::BtcLocked(..))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn is_xmr_locked(state: &BobState) -> bool {
|
|
|
|
matches!(state, BobState::XmrLocked(..))
|
2020-12-02 01:09:43 +00:00
|
|
|
}
|
|
|
|
|
2020-11-12 00:06:34 +00:00
|
|
|
// State machine driver for swap execution
|
2020-12-02 01:36:47 +00:00
|
|
|
#[allow(clippy::too_many_arguments)]
|
2020-11-12 00:06:34 +00:00
|
|
|
#[async_recursion]
|
2020-12-02 01:09:43 +00:00
|
|
|
pub async fn run_until<R>(
|
2020-11-12 00:06:34 +00:00
|
|
|
state: BobState,
|
2020-12-02 01:36:47 +00:00
|
|
|
is_target_state: fn(&BobState) -> bool,
|
2020-12-10 02:55:29 +00:00
|
|
|
mut event_loop_handle: EventLoopHandle,
|
2020-11-12 00:06:34 +00:00
|
|
|
db: Database,
|
|
|
|
bitcoin_wallet: Arc<crate::bitcoin::Wallet>,
|
|
|
|
monero_wallet: Arc<crate::monero::Wallet>,
|
2020-11-30 02:25:11 +00:00
|
|
|
mut rng: R,
|
2020-11-26 02:55:56 +00:00
|
|
|
swap_id: Uuid,
|
2020-11-30 02:25:11 +00:00
|
|
|
) -> Result<BobState>
|
|
|
|
where
|
|
|
|
R: RngCore + CryptoRng + Send,
|
|
|
|
{
|
2020-12-07 02:55:13 +00:00
|
|
|
info!("Current state: {}", state);
|
2020-12-02 01:36:47 +00:00
|
|
|
if is_target_state(&state) {
|
2020-12-02 01:09:43 +00:00
|
|
|
Ok(state)
|
|
|
|
} else {
|
|
|
|
match state {
|
|
|
|
BobState::Started {
|
2020-11-30 02:25:11 +00:00
|
|
|
state0,
|
|
|
|
amounts,
|
2020-12-01 03:30:02 +00:00
|
|
|
addr,
|
2020-12-02 01:09:43 +00:00
|
|
|
} => {
|
2020-12-10 03:59:09 +00:00
|
|
|
let (state2, alice_peer_id) = negotiate(
|
2020-12-02 01:09:43 +00:00
|
|
|
state0,
|
|
|
|
amounts,
|
2020-12-10 02:55:29 +00:00
|
|
|
&mut event_loop_handle,
|
2020-12-02 01:09:43 +00:00
|
|
|
addr,
|
|
|
|
&mut rng,
|
|
|
|
bitcoin_wallet.clone(),
|
|
|
|
)
|
2020-12-02 01:36:47 +00:00
|
|
|
.await?;
|
2020-12-08 03:54:08 +00:00
|
|
|
|
|
|
|
let state = BobState::Negotiated(state2, alice_peer_id);
|
|
|
|
let db_state = state.clone().into();
|
|
|
|
db.insert_latest_state(swap_id, state::Swap::Bob(db_state))
|
|
|
|
.await?;
|
2020-12-02 01:09:43 +00:00
|
|
|
run_until(
|
2020-12-08 03:54:08 +00:00
|
|
|
state,
|
2020-12-02 01:36:47 +00:00
|
|
|
is_target_state,
|
2020-12-10 02:55:29 +00:00
|
|
|
event_loop_handle,
|
2020-12-02 01:09:43 +00:00
|
|
|
db,
|
|
|
|
bitcoin_wallet,
|
|
|
|
monero_wallet,
|
|
|
|
rng,
|
|
|
|
swap_id,
|
|
|
|
)
|
2020-12-02 01:36:47 +00:00
|
|
|
.await
|
2020-12-02 01:09:43 +00:00
|
|
|
}
|
|
|
|
BobState::Negotiated(state2, alice_peer_id) => {
|
|
|
|
// Alice and Bob have exchanged info
|
|
|
|
let state3 = state2.lock_btc(bitcoin_wallet.as_ref()).await?;
|
2020-12-08 03:54:08 +00:00
|
|
|
|
|
|
|
let state = BobState::BtcLocked(state3, alice_peer_id);
|
|
|
|
let db_state = state.clone().into();
|
|
|
|
db.insert_latest_state(swap_id, state::Swap::Bob(db_state))
|
|
|
|
.await?;
|
2020-12-02 01:09:43 +00:00
|
|
|
run_until(
|
2020-12-08 03:54:08 +00:00
|
|
|
state,
|
2020-12-02 01:36:47 +00:00
|
|
|
is_target_state,
|
2020-12-10 02:55:29 +00:00
|
|
|
event_loop_handle,
|
2020-12-02 01:09:43 +00:00
|
|
|
db,
|
|
|
|
bitcoin_wallet,
|
|
|
|
monero_wallet,
|
|
|
|
rng,
|
|
|
|
swap_id,
|
|
|
|
)
|
2020-12-02 01:36:47 +00:00
|
|
|
.await
|
2020-12-02 01:09:43 +00:00
|
|
|
}
|
|
|
|
// Bob has locked Btc
|
|
|
|
// Watch for Alice to Lock Xmr or for t1 to elapse
|
|
|
|
BobState::BtcLocked(state3, alice_peer_id) => {
|
|
|
|
// todo: watch until t1, not indefinetely
|
2020-12-10 02:55:29 +00:00
|
|
|
let msg2 = event_loop_handle.recv_message2().await?;
|
2020-12-07 02:31:14 +00:00
|
|
|
let state4 = state3
|
|
|
|
.watch_for_lock_xmr(monero_wallet.as_ref(), msg2)
|
|
|
|
.await?;
|
|
|
|
|
2020-12-08 03:54:08 +00:00
|
|
|
let state = BobState::XmrLocked(state4, alice_peer_id);
|
|
|
|
let db_state = state.clone().into();
|
|
|
|
db.insert_latest_state(swap_id, state::Swap::Bob(db_state))
|
|
|
|
.await?;
|
2020-12-02 01:09:43 +00:00
|
|
|
run_until(
|
2020-12-08 03:54:08 +00:00
|
|
|
state,
|
2020-12-02 01:36:47 +00:00
|
|
|
is_target_state,
|
2020-12-10 02:55:29 +00:00
|
|
|
event_loop_handle,
|
2020-12-02 01:09:43 +00:00
|
|
|
db,
|
|
|
|
bitcoin_wallet,
|
|
|
|
monero_wallet,
|
|
|
|
rng,
|
|
|
|
swap_id,
|
|
|
|
)
|
2020-12-02 01:36:47 +00:00
|
|
|
.await
|
2020-12-02 01:09:43 +00:00
|
|
|
}
|
|
|
|
BobState::XmrLocked(state, alice_peer_id) => {
|
|
|
|
// Alice has locked Xmr
|
|
|
|
// Bob sends Alice his key
|
|
|
|
let tx_redeem_encsig = state.tx_redeem_encsig();
|
|
|
|
// Do we have to wait for a response?
|
|
|
|
// What if Alice fails to receive this? Should we always resend?
|
|
|
|
// todo: If we cannot dial Alice we should go to EncSigSent. Maybe dialing
|
|
|
|
// should happen in this arm?
|
2020-12-10 02:55:29 +00:00
|
|
|
event_loop_handle
|
2020-12-09 03:10:24 +00:00
|
|
|
.send_message3(alice_peer_id.clone(), tx_redeem_encsig)
|
|
|
|
.await?;
|
2020-11-12 00:06:34 +00:00
|
|
|
|
2020-12-08 03:54:08 +00:00
|
|
|
let state = BobState::EncSigSent(state, alice_peer_id);
|
|
|
|
let db_state = state.clone().into();
|
|
|
|
db.insert_latest_state(swap_id, state::Swap::Bob(db_state))
|
|
|
|
.await?;
|
2020-12-02 01:09:43 +00:00
|
|
|
run_until(
|
2020-12-08 03:54:08 +00:00
|
|
|
state,
|
2020-12-02 01:36:47 +00:00
|
|
|
is_target_state,
|
2020-12-10 02:55:29 +00:00
|
|
|
event_loop_handle,
|
2020-12-02 01:09:43 +00:00
|
|
|
db,
|
|
|
|
bitcoin_wallet,
|
|
|
|
monero_wallet,
|
|
|
|
rng,
|
|
|
|
swap_id,
|
|
|
|
)
|
2020-12-02 01:36:47 +00:00
|
|
|
.await
|
2020-12-02 01:09:43 +00:00
|
|
|
}
|
|
|
|
BobState::EncSigSent(state, ..) => {
|
|
|
|
// Watch for redeem
|
|
|
|
let redeem_watcher = state.watch_for_redeem_btc(bitcoin_wallet.as_ref());
|
|
|
|
let t1_timeout = state.wait_for_t1(bitcoin_wallet.as_ref());
|
2020-11-12 00:06:34 +00:00
|
|
|
|
2020-12-08 03:54:08 +00:00
|
|
|
// TODO(Franck): Check if db save and run_until can be factorized
|
2020-12-02 01:09:43 +00:00
|
|
|
tokio::select! {
|
2020-12-02 01:36:47 +00:00
|
|
|
val = redeem_watcher => {
|
2020-12-08 03:54:08 +00:00
|
|
|
let state = BobState::BtcRedeemed(val?);
|
|
|
|
let db_state = state.clone().into();
|
|
|
|
db.insert_latest_state(swap_id, state::Swap::Bob(db_state)).await?;
|
2020-12-02 01:36:47 +00:00
|
|
|
run_until(
|
2020-12-08 03:54:08 +00:00
|
|
|
state,
|
2020-12-02 01:36:47 +00:00
|
|
|
is_target_state,
|
2020-12-10 02:55:29 +00:00
|
|
|
event_loop_handle,
|
2020-12-02 01:36:47 +00:00
|
|
|
db,
|
|
|
|
bitcoin_wallet,
|
|
|
|
monero_wallet,
|
|
|
|
rng,
|
|
|
|
swap_id,
|
|
|
|
)
|
|
|
|
.await
|
2020-11-12 00:06:34 +00:00
|
|
|
}
|
2020-12-02 01:36:47 +00:00
|
|
|
_ = t1_timeout => {
|
|
|
|
// Check whether TxCancel has been published.
|
|
|
|
// We should not fail if the transaction is already on the blockchain
|
|
|
|
if state.check_for_tx_cancel(bitcoin_wallet.as_ref()).await.is_err() {
|
|
|
|
state.submit_tx_cancel(bitcoin_wallet.as_ref()).await?;
|
|
|
|
}
|
2020-11-12 00:06:34 +00:00
|
|
|
|
2020-12-08 03:54:08 +00:00
|
|
|
let state = BobState::Cancelled(state);
|
|
|
|
let db_state = state.clone().into();
|
|
|
|
db.insert_latest_state(swap_id, state::Swap::Bob(db_state)).await?;
|
2020-12-02 01:36:47 +00:00
|
|
|
run_until(
|
2020-12-08 03:54:08 +00:00
|
|
|
state,
|
|
|
|
is_target_state,
|
2020-12-10 02:55:29 +00:00
|
|
|
event_loop_handle,
|
2020-12-02 01:36:47 +00:00
|
|
|
db,
|
|
|
|
bitcoin_wallet,
|
|
|
|
monero_wallet,
|
|
|
|
rng,
|
2020-12-08 03:54:08 +00:00
|
|
|
swap_id
|
2020-12-02 01:36:47 +00:00
|
|
|
)
|
|
|
|
.await
|
2020-11-12 00:06:34 +00:00
|
|
|
|
2020-12-02 01:36:47 +00:00
|
|
|
}
|
2020-11-12 00:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
2020-12-02 01:09:43 +00:00
|
|
|
BobState::BtcRedeemed(state) => {
|
|
|
|
// Bob redeems XMR using revealed s_a
|
|
|
|
state.claim_xmr(monero_wallet.as_ref()).await?;
|
2020-12-08 03:54:08 +00:00
|
|
|
|
|
|
|
let state = BobState::XmrRedeemed;
|
|
|
|
let db_state = state.clone().into();
|
|
|
|
db.insert_latest_state(swap_id, state::Swap::Bob(db_state))
|
|
|
|
.await?;
|
2020-12-02 01:09:43 +00:00
|
|
|
run_until(
|
2020-12-08 03:54:08 +00:00
|
|
|
state,
|
2020-12-02 01:36:47 +00:00
|
|
|
is_target_state,
|
2020-12-10 02:55:29 +00:00
|
|
|
event_loop_handle,
|
2020-12-02 01:09:43 +00:00
|
|
|
db,
|
|
|
|
bitcoin_wallet,
|
|
|
|
monero_wallet,
|
|
|
|
rng,
|
|
|
|
swap_id,
|
|
|
|
)
|
2020-12-02 01:36:47 +00:00
|
|
|
.await
|
|
|
|
}
|
2020-12-11 01:34:20 +00:00
|
|
|
BobState::Cancelled(state) => {
|
2020-12-08 03:54:08 +00:00
|
|
|
// TODO
|
2020-12-02 01:36:47 +00:00
|
|
|
// Bob has cancelled the swap
|
2020-12-08 03:54:08 +00:00
|
|
|
let state = match state.current_epoch(bitcoin_wallet.as_ref()).await? {
|
2020-12-11 01:34:20 +00:00
|
|
|
Epoch::T0 => panic!("Cancelled before t1??? Something is really wrong"),
|
|
|
|
Epoch::T1 => {
|
|
|
|
state.refund_btc(bitcoin_wallet.as_ref()).await?;
|
2020-12-08 03:54:08 +00:00
|
|
|
BobState::BtcRefunded(state)
|
2020-12-11 01:34:20 +00:00
|
|
|
}
|
2020-12-08 03:54:08 +00:00
|
|
|
Epoch::T2 => BobState::Punished,
|
|
|
|
};
|
|
|
|
|
|
|
|
let db_state = state.clone().into();
|
|
|
|
db.insert_latest_state(swap_id, state::Swap::Bob(db_state))
|
|
|
|
.await?;
|
|
|
|
run_until(
|
|
|
|
state,
|
|
|
|
is_target_state,
|
|
|
|
event_loop_handle,
|
|
|
|
db,
|
|
|
|
bitcoin_wallet,
|
|
|
|
monero_wallet,
|
|
|
|
rng,
|
|
|
|
swap_id,
|
|
|
|
)
|
|
|
|
.await
|
2020-12-02 01:36:47 +00:00
|
|
|
}
|
2020-12-11 05:49:19 +00:00
|
|
|
BobState::BtcRefunded(state4) => Ok(BobState::BtcRefunded(state4)),
|
2020-12-10 00:51:58 +00:00
|
|
|
BobState::Punished => Ok(BobState::Punished),
|
|
|
|
BobState::SafelyAborted => Ok(BobState::SafelyAborted),
|
|
|
|
BobState::XmrRedeemed => Ok(BobState::XmrRedeemed),
|
2020-11-12 00:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|