mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-28 17:09:37 -05:00
Replace swap recover
terminology with resume
This commit is contained in:
parent
8cc470a80e
commit
5ba830f3bf
@ -41,8 +41,6 @@ trait Rng: RngCore + CryptoRng + Send {}
|
||||
|
||||
impl<T> Rng for T where T: RngCore + CryptoRng + Send {}
|
||||
|
||||
// The same data structure is used for swap execution and recovery.
|
||||
// This allows for a seamless transition from a failed swap to recovery.
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum AliceState {
|
||||
Started {
|
||||
@ -128,7 +126,7 @@ impl From<&AliceState> for state::Alice {
|
||||
AliceState::T1Expired { state3 } => Alice::T1Expired(state3.clone()),
|
||||
AliceState::Punished => Alice::SwapComplete,
|
||||
AliceState::SafelyAborted => Alice::SwapComplete,
|
||||
// TODO: Potentially add support to recover swaps that are not Negotiated
|
||||
// TODO: Potentially add support to resume swaps that are not Negotiated
|
||||
AliceState::Started { .. } => {
|
||||
panic!("Alice attempted to save swap before being negotiated")
|
||||
}
|
||||
@ -235,7 +233,7 @@ pub async fn swap(
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn recover(
|
||||
pub async fn resume_from_database(
|
||||
event_loop_handle: EventLoopHandle,
|
||||
bitcoin_wallet: Arc<crate::bitcoin::Wallet>,
|
||||
monero_wallet: Arc<crate::monero::Wallet>,
|
||||
|
@ -222,7 +222,7 @@ async fn main() -> Result<()> {
|
||||
// Print the table to stdout
|
||||
table.printstd();
|
||||
}
|
||||
Options::Recover { .. } => todo!("implement this"),
|
||||
Options::Resume { .. } => todo!("implement this"),
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -17,8 +17,6 @@ use xmr_btc::{
|
||||
Epoch,
|
||||
};
|
||||
|
||||
// The same data structure is used for swap execution and recovery.
|
||||
// This allows for a seamless transition from a failed swap to recovery.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum BobState {
|
||||
Started {
|
||||
@ -124,7 +122,7 @@ where
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn recover<R>(
|
||||
pub async fn resume_from_database<R>(
|
||||
event_loop_handle: EventLoopHandle,
|
||||
db: Database,
|
||||
bitcoin_wallet: Arc<crate::bitcoin::Wallet>,
|
||||
|
@ -64,7 +64,7 @@ pub enum Options {
|
||||
receive_monero: xmr_btc::monero::Amount,
|
||||
},
|
||||
History,
|
||||
Recover {
|
||||
Resume {
|
||||
#[structopt(required = true)]
|
||||
swap_id: Uuid,
|
||||
|
||||
|
@ -114,7 +114,7 @@ async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
|
||||
testutils::init_alice_event_loop(alice_multiaddr);
|
||||
let _alice_swarm_fut = tokio::spawn(async move { event_loop_after_restart.run().await });
|
||||
|
||||
let alice_state = alice::swap::recover(
|
||||
let alice_state = alice::swap::resume_from_database(
|
||||
event_loop_handle_after_restart,
|
||||
alice_btc_wallet,
|
||||
alice_xmr_wallet,
|
||||
|
@ -114,7 +114,7 @@ async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
|
||||
testutils::init_bob_event_loop();
|
||||
let _alice_swarm_fut = tokio::spawn(async move { event_loop_after_restart.run().await });
|
||||
|
||||
let alice_state = bob::swap::recover(
|
||||
let alice_state = bob::swap::resume_from_database(
|
||||
event_loop_handle_after_restart,
|
||||
bob_db,
|
||||
bob_btc_wallet,
|
||||
|
Loading…
Reference in New Issue
Block a user