fixup! `swap_setup` instead of `spot_price` and `execution_setup`

cleanup-module-boundaries
Daniel Karzel 3 years ago
parent 85f5635663
commit 27c255646f
No known key found for this signature in database
GPG Key ID: 30C3FC2E438ADB6E

@ -1,12 +1,10 @@
//! Run an XMR/BTC swap in the role of Alice.
//! Alice holds XMR and wishes receive BTC.
use std::sync::Arc;
use uuid::Uuid;
use crate::database::Database;
use crate::env::Config;
use crate::{bitcoin, monero};
use std::sync::Arc;
use uuid::Uuid;
pub use self::behaviour::{Behaviour, OutEvent};
pub use self::event_loop::{EventLoop, EventLoopHandle};

@ -1,15 +1,14 @@
use anyhow::{anyhow, Error};
use libp2p::ping::{Ping, PingEvent};
use libp2p::request_response::{RequestId, ResponseChannel};
use libp2p::{NetworkBehaviour, PeerId};
use uuid::Uuid;
use crate::env;
use crate::network::quote::BidQuote;
use crate::network::{encrypted_signature, quote, transfer_proof};
use crate::protocol::alice::event_loop::LatestRate;
use crate::protocol::alice::swap_setup::WalletSnapshot;
use crate::protocol::alice::{swap_setup, State3};
use anyhow::{anyhow, Error};
use libp2p::ping::{Ping, PingEvent};
use libp2p::request_response::{RequestId, ResponseChannel};
use libp2p::{NetworkBehaviour, PeerId};
use uuid::Uuid;
#[derive(Debug)]
pub enum OutEvent {

@ -152,7 +152,13 @@ where
match swarm_event {
SwarmEvent::Behaviour(OutEvent::SwapSetupInitiated { mut send_wallet_snapshot }) => {
let (btc, responder) = send_wallet_snapshot.recv().await.expect("TODO: handle error");
let (btc, responder) = match send_wallet_snapshot.recv().await {
Ok((btc, responder)) => (btc, responder),
Err(error) => {
tracing::error!("Swap request will be ignored because of a failure when requesting information for the wallet snapshot: {:#}", error);
continue;
}
};
let wallet_snapshot = match WalletSnapshot::capture(&self.bitcoin_wallet, &self.monero_wallet, btc).await {
Ok(wallet_snapshot) => wallet_snapshot,

Loading…
Cancel
Save