mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-25 07:29:32 -05:00
Don't repeat the module name within the type
This commit is contained in:
parent
87f928f56c
commit
5953037b81
@ -26,7 +26,6 @@ use swap::database::Database;
|
||||
use swap::execution_params::GetExecutionParams;
|
||||
use swap::network::quote::BidQuote;
|
||||
use swap::protocol::bob;
|
||||
use swap::protocol::bob::cancel::CancelError;
|
||||
use swap::protocol::bob::{Builder, EventLoop};
|
||||
use swap::seed::Seed;
|
||||
use swap::{bitcoin, execution_params, monero};
|
||||
@ -213,11 +212,11 @@ async fn main() -> Result<()> {
|
||||
Ok((txid, _)) => {
|
||||
debug!("Cancel transaction successfully published with id {}", txid)
|
||||
}
|
||||
Err(CancelError::CancelTimelockNotExpiredYet) => error!(
|
||||
Err(bob::cancel::Error::CancelTimelockNotExpiredYet) => error!(
|
||||
"The Cancel Transaction cannot be published yet, \
|
||||
because the timelock has not expired. Please try again later."
|
||||
),
|
||||
Err(CancelError::CancelTxAlreadyPublished) => {
|
||||
Err(bob::cancel::Error::CancelTxAlreadyPublished) => {
|
||||
warn!("The Cancel Transaction has already been published.")
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use std::sync::Arc;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, thiserror::Error, Clone, Copy)]
|
||||
pub enum CancelError {
|
||||
pub enum Error {
|
||||
#[error("The cancel timelock has not expired yet.")]
|
||||
CancelTimelockNotExpiredYet,
|
||||
#[error("The cancel transaction has already been published.")]
|
||||
@ -19,7 +19,7 @@ pub async fn cancel(
|
||||
bitcoin_wallet: Arc<Wallet>,
|
||||
db: Database,
|
||||
force: bool,
|
||||
) -> Result<Result<(Txid, BobState), CancelError>> {
|
||||
) -> Result<Result<(Txid, BobState), Error>> {
|
||||
let state4 = match state {
|
||||
BobState::BtcLocked(state3) => state3.cancel(),
|
||||
BobState::XmrLockProofReceived { state, .. } => state.cancel(),
|
||||
@ -35,7 +35,7 @@ pub async fn cancel(
|
||||
|
||||
if !force {
|
||||
if let ExpiredTimelocks::None = state4.expired_timelock(bitcoin_wallet.as_ref()).await? {
|
||||
return Ok(Err(CancelError::CancelTimelockNotExpiredYet));
|
||||
return Ok(Err(Error::CancelTimelockNotExpiredYet));
|
||||
}
|
||||
|
||||
if state4
|
||||
@ -47,7 +47,7 @@ pub async fn cancel(
|
||||
let db_state = state.into();
|
||||
db.insert_latest_state(swap_id, Swap::Bob(db_state)).await?;
|
||||
|
||||
return Ok(Err(CancelError::CancelTxAlreadyPublished));
|
||||
return Ok(Err(Error::CancelTxAlreadyPublished));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
pub mod testutils;
|
||||
|
||||
use bob::cancel::CancelError;
|
||||
use bob::cancel::Error;
|
||||
use swap::protocol::bob;
|
||||
use swap::protocol::bob::BobState;
|
||||
use testutils::bob_run_until::is_btc_locked;
|
||||
@ -30,7 +30,7 @@ async fn given_bob_manually_cancels_when_timelock_not_expired_errors() {
|
||||
.err()
|
||||
.unwrap();
|
||||
|
||||
assert!(matches!(result, CancelError::CancelTimelockNotExpiredYet));
|
||||
assert!(matches!(result, Error::CancelTimelockNotExpiredYet));
|
||||
|
||||
let (bob_swap, bob_join_handle) = ctx.stop_and_resume_bob_from_db(bob_join_handle).await;
|
||||
assert!(matches!(bob_swap.state, BobState::BtcLocked { .. }));
|
||||
|
Loading…
Reference in New Issue
Block a user