diff --git a/swap/src/protocol/alice.rs b/swap/src/protocol/alice.rs index e9941172..eb0b720a 100644 --- a/swap/src/protocol/alice.rs +++ b/swap/src/protocol/alice.rs @@ -1,6 +1,6 @@ //! Run an XMR/BTC swap in the role of Alice. //! Alice holds XMR and wishes receive BTC. -use anyhow::Result; +use anyhow::{bail, Result}; use libp2p::{request_response::ResponseChannel, NetworkBehaviour, PeerId}; use tracing::{debug, info}; @@ -131,7 +131,10 @@ impl SwapFactory { let resume_state = if let database::Swap::Alice(state) = db.get_state(self.swap_id)? { state.into() } else { - unreachable!() + bail!( + "Trying to load swap with id {} for the wrong direction.", + self.swap_id + ) }; let (event_loop, event_loop_handle) = init_alice_event_loop( diff --git a/swap/src/protocol/bob.rs b/swap/src/protocol/bob.rs index 5890f5b4..4ec70fba 100644 --- a/swap/src/protocol/bob.rs +++ b/swap/src/protocol/bob.rs @@ -1,6 +1,6 @@ //! Run an XMR/BTC swap in the role of Bob. //! Bob holds BTC and wishes receive XMR. -use anyhow::Result; +use anyhow::{bail, Result}; use libp2p::{core::Multiaddr, NetworkBehaviour, PeerId}; use tracing::{debug, info}; @@ -133,7 +133,10 @@ impl SwapFactory { let resume_state = if let database::Swap::Bob(state) = db.get_state(self.swap_id)? { state.into() } else { - unreachable!() + bail!( + "Trying to load swap with id {} for the wrong direction.", + self.swap_id + ) }; let (event_loop, event_loop_handle) = init_bob_event_loop(