mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-05-20 15:40:48 -04:00
Do not introduced State6
This commit is contained in:
parent
8615aaed6e
commit
9a823dca4c
4 changed files with 30 additions and 41 deletions
|
@ -33,9 +33,9 @@ pub enum Bob {
|
|||
#[derive(Clone, strum::Display, Debug, Deserialize, Serialize, PartialEq)]
|
||||
pub enum BobEndState {
|
||||
SafelyAborted,
|
||||
XmrRedeemed(Box<bob::State6>),
|
||||
XmrRedeemed { tx_lock_id: bitcoin::Txid },
|
||||
BtcRefunded(Box<bob::State4>),
|
||||
BtcPunished(Box<bob::State6>),
|
||||
BtcPunished { tx_lock_id: bitcoin::Txid },
|
||||
}
|
||||
|
||||
impl From<BobState> for Bob {
|
||||
|
@ -50,8 +50,12 @@ impl From<BobState> for Bob {
|
|||
BobState::CancelTimelockExpired(state4) => Bob::CancelTimelockExpired(state4),
|
||||
BobState::BtcCancelled(state4) => Bob::BtcCancelled(state4),
|
||||
BobState::BtcRefunded(state4) => Bob::Done(BobEndState::BtcRefunded(Box::new(state4))),
|
||||
BobState::XmrRedeemed(state6) => Bob::Done(BobEndState::XmrRedeemed(Box::new(state6))),
|
||||
BobState::BtcPunished(state6) => Bob::Done(BobEndState::BtcPunished(Box::new(state6))),
|
||||
BobState::XmrRedeemed { tx_lock_id } => {
|
||||
Bob::Done(BobEndState::XmrRedeemed { tx_lock_id })
|
||||
}
|
||||
BobState::BtcPunished { tx_lock_id } => {
|
||||
Bob::Done(BobEndState::BtcPunished { tx_lock_id })
|
||||
}
|
||||
BobState::SafelyAborted => Bob::Done(BobEndState::SafelyAborted),
|
||||
}
|
||||
}
|
||||
|
@ -70,9 +74,9 @@ impl From<Bob> for BobState {
|
|||
Bob::BtcCancelled(state4) => BobState::BtcCancelled(state4),
|
||||
Bob::Done(end_state) => match end_state {
|
||||
BobEndState::SafelyAborted => BobState::SafelyAborted,
|
||||
BobEndState::XmrRedeemed(state6) => BobState::XmrRedeemed(*state6),
|
||||
BobEndState::XmrRedeemed { tx_lock_id } => BobState::XmrRedeemed { tx_lock_id },
|
||||
BobEndState::BtcRefunded(state4) => BobState::BtcRefunded(*state4),
|
||||
BobEndState::BtcPunished(state6) => BobState::BtcPunished(*state6),
|
||||
BobEndState::BtcPunished { tx_lock_id } => BobState::BtcPunished { tx_lock_id },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue