mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Avoid problems when re-ordering / changing Bob's states
Make it explicit in which states we are able NOT to cancel/refund.
This commit is contained in:
parent
e6dd194f77
commit
d233e9914e
@ -26,7 +26,14 @@ pub async fn cancel(
|
||||
BobState::XmrLocked(state4) => state4.cancel(),
|
||||
BobState::EncSigSent(state4) => state4.cancel(),
|
||||
BobState::CancelTimelockExpired(state6) => state6,
|
||||
_ => bail!(
|
||||
BobState::Started { .. }
|
||||
| BobState::ExecutionSetupDone(_)
|
||||
| BobState::BtcRedeemed(_)
|
||||
| BobState::BtcCancelled(_)
|
||||
| BobState::BtcRefunded(_)
|
||||
| BobState::XmrRedeemed { .. }
|
||||
| BobState::BtcPunished { .. }
|
||||
| BobState::SafelyAborted => bail!(
|
||||
"Cannot cancel swap {} because it is in state {} which is not refundable.",
|
||||
swap_id,
|
||||
state
|
||||
|
@ -24,7 +24,13 @@ pub async fn refund(
|
||||
BobState::EncSigSent(state4) => state4.cancel(),
|
||||
BobState::CancelTimelockExpired(state6) => state6,
|
||||
BobState::BtcCancelled(state6) => state6,
|
||||
_ => bail!(
|
||||
BobState::Started { .. }
|
||||
| BobState::ExecutionSetupDone(_)
|
||||
| BobState::BtcRedeemed(_)
|
||||
| BobState::BtcRefunded(_)
|
||||
| BobState::XmrRedeemed { .. }
|
||||
| BobState::BtcPunished { .. }
|
||||
| BobState::SafelyAborted => bail!(
|
||||
"Cannot refund swap {} because it is in state {} which is not refundable.",
|
||||
swap_id,
|
||||
state
|
||||
|
Loading…
Reference in New Issue
Block a user