mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-26 07:59:28 -05:00
Rename function explicit to cancellation to cancel
For transitioning to state4 we either go into a redeem or a cancellation scenario. The function name state4 is misleading, because it is only used for cancellation scenarios.
This commit is contained in:
parent
1404057dbe
commit
fa04775188
@ -23,8 +23,8 @@ pub async fn cancel(
|
|||||||
force: bool,
|
force: bool,
|
||||||
) -> Result<Result<(Txid, BobState), CancelError>> {
|
) -> Result<Result<(Txid, BobState), CancelError>> {
|
||||||
let state4 = match state {
|
let state4 = match state {
|
||||||
BobState::BtcLocked(state3) => state3.state4(),
|
BobState::BtcLocked(state3) => state3.cancel(),
|
||||||
BobState::XmrLockProofReceived { state, .. } => state.state4(),
|
BobState::XmrLockProofReceived { state, .. } => state.cancel(),
|
||||||
BobState::XmrLocked(state4) => state4,
|
BobState::XmrLocked(state4) => state4,
|
||||||
BobState::EncSigSent(state4) => state4,
|
BobState::EncSigSent(state4) => state4,
|
||||||
BobState::CancelTimelockExpired(state4) => state4,
|
BobState::CancelTimelockExpired(state4) => state4,
|
||||||
|
@ -22,8 +22,8 @@ pub async fn refund(
|
|||||||
) -> Result<Result<BobState, SwapNotCancelledYet>> {
|
) -> Result<Result<BobState, SwapNotCancelledYet>> {
|
||||||
let state4 = if force {
|
let state4 = if force {
|
||||||
match state {
|
match state {
|
||||||
BobState::BtcLocked(state3) => state3.state4(),
|
BobState::BtcLocked(state3) => state3.cancel(),
|
||||||
BobState::XmrLockProofReceived { state, .. } => state.state4(),
|
BobState::XmrLockProofReceived { state, .. } => state.cancel(),
|
||||||
BobState::XmrLocked(state4) => state4,
|
BobState::XmrLocked(state4) => state4,
|
||||||
BobState::EncSigSent(state4) => state4,
|
BobState::EncSigSent(state4) => state4,
|
||||||
BobState::CancelTimelockExpired(state4) => state4,
|
BobState::CancelTimelockExpired(state4) => state4,
|
||||||
|
@ -379,7 +379,7 @@ impl State3 {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn state4(&self) -> State4 {
|
pub fn cancel(&self) -> State4 {
|
||||||
State4 {
|
State4 {
|
||||||
A: self.A,
|
A: self.A,
|
||||||
b: self.b.clone(),
|
b: self.b.clone(),
|
||||||
|
@ -141,12 +141,12 @@ async fn run_until_internal(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ = cancel_timelock_expires => {
|
_ = cancel_timelock_expires => {
|
||||||
let state4 = state3.state4();
|
let state4 = state3.cancel();
|
||||||
BobState::CancelTimelockExpired(state4)
|
BobState::CancelTimelockExpired(state4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let state4 = state3.state4();
|
let state4 = state3.cancel();
|
||||||
BobState::CancelTimelockExpired(state4)
|
BobState::CancelTimelockExpired(state4)
|
||||||
};
|
};
|
||||||
let db_state = state.clone().into();
|
let db_state = state.clone().into();
|
||||||
@ -188,18 +188,18 @@ async fn run_until_internal(
|
|||||||
Err(InsufficientFunds {..}) => {
|
Err(InsufficientFunds {..}) => {
|
||||||
info!("The other party has locked insufficient Monero funds! Waiting for refund...");
|
info!("The other party has locked insufficient Monero funds! Waiting for refund...");
|
||||||
state.wait_for_cancel_timelock_to_expire(bitcoin_wallet.as_ref()).await?;
|
state.wait_for_cancel_timelock_to_expire(bitcoin_wallet.as_ref()).await?;
|
||||||
let state4 = state.state4();
|
let state4 = state.cancel();
|
||||||
BobState::CancelTimelockExpired(state4)
|
BobState::CancelTimelockExpired(state4)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ = cancel_timelock_expires => {
|
_ = cancel_timelock_expires => {
|
||||||
let state4 = state.state4();
|
let state4 = state.cancel();
|
||||||
BobState::CancelTimelockExpired(state4)
|
BobState::CancelTimelockExpired(state4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let state4 = state.state4();
|
let state4 = state.cancel();
|
||||||
BobState::CancelTimelockExpired(state4)
|
BobState::CancelTimelockExpired(state4)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user