mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-09 23:12:40 -04:00
Alice's spot_price Behaviour reports back Error
Instead of handling all errors on the inside spot_price errors are bubbled up (as `SwapRequestDeclined`). This allows us to test both Alice's and Bob's behaviour for all scenarios.
This commit is contained in:
parent
5aac76598d
commit
03a0dc73cd
3 changed files with 70 additions and 57 deletions
|
@ -6,11 +6,14 @@ 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)]
|
||||
pub enum OutEvent {
|
||||
SwapRequestDeclined {
|
||||
peer: PeerId,
|
||||
error: spot_price::Error,
|
||||
},
|
||||
ExecutionSetupStart {
|
||||
peer: PeerId,
|
||||
btc: bitcoin::Amount,
|
||||
|
@ -65,7 +68,7 @@ impl OutEvent {
|
|||
#[allow(missing_debug_implementations)]
|
||||
pub struct Behaviour<LR>
|
||||
where
|
||||
LR: LatestRate + Send + 'static + Debug,
|
||||
LR: LatestRate + Send + 'static,
|
||||
{
|
||||
pub quote: quote::Behaviour,
|
||||
pub spot_price: spot_price::Behaviour<LR>,
|
||||
|
@ -76,7 +79,7 @@ where
|
|||
|
||||
impl<LR> Behaviour<LR>
|
||||
where
|
||||
LR: LatestRate + Send + 'static + Debug,
|
||||
LR: LatestRate + Send + 'static,
|
||||
{
|
||||
pub fn new(
|
||||
balance: monero::Amount,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue