mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-10 07:20:07 -04:00
Decouple ASB/CLI Errors from Error sent over wire
What goes over the wire should not be coupled to the errors being printed. For the CLI and ASB we introduce a separate error enum that is used for logging. When sending over the wire the errors are mapped to and from the `network::spot_price::Error`. As part of Bob-specific spot_price code was moved from the network into bob. Clearly separation of the network API from bob/alice.
This commit is contained in:
parent
52f648e1de
commit
5aac76598d
9 changed files with 190 additions and 61 deletions
|
@ -6,6 +6,7 @@ use crate::protocol::alice::{execution_setup, spot_price, State3};
|
|||
use anyhow::{anyhow, Error};
|
||||
use libp2p::request_response::{RequestId, ResponseChannel};
|
||||
use libp2p::{NetworkBehaviour, PeerId};
|
||||
use std::fmt::Debug;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -62,7 +63,10 @@ impl OutEvent {
|
|||
#[derive(NetworkBehaviour)]
|
||||
#[behaviour(out_event = "OutEvent", event_process = false)]
|
||||
#[allow(missing_debug_implementations)]
|
||||
pub struct Behaviour<LR: LatestRate + Send + 'static> {
|
||||
pub struct Behaviour<LR>
|
||||
where
|
||||
LR: LatestRate + Send + 'static + Debug,
|
||||
{
|
||||
pub quote: quote::Behaviour,
|
||||
pub spot_price: spot_price::Behaviour<LR>,
|
||||
pub execution_setup: execution_setup::Behaviour,
|
||||
|
@ -72,7 +76,7 @@ pub struct Behaviour<LR: LatestRate + Send + 'static> {
|
|||
|
||||
impl<LR> Behaviour<LR>
|
||||
where
|
||||
LR: LatestRate + Send + 'static,
|
||||
LR: LatestRate + Send + 'static + Debug,
|
||||
{
|
||||
pub fn new(
|
||||
balance: monero::Amount,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue