From c2c9e975efaca7591e2aeeb292ef45bd6c37c524 Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Fri, 25 Jun 2021 16:10:25 +1000 Subject: [PATCH] Quote protocol asb/cli instead of alice/bob The quote protocol has no relation to the protocol roles but to the application hence the rename. --- swap/src/asb/behaviour.rs | 2 +- swap/src/cli/behaviour.rs | 2 +- swap/src/network/quote.rs | 14 ++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/swap/src/asb/behaviour.rs b/swap/src/asb/behaviour.rs index 8f9ef6b8..fda8b496 100644 --- a/swap/src/asb/behaviour.rs +++ b/swap/src/asb/behaviour.rs @@ -94,7 +94,7 @@ where env_config: env::Config, ) -> Self { Self { - quote: quote::alice(), + quote: quote::asb(), swap_setup: alice::Behaviour::new( min_buy, max_buy, diff --git a/swap/src/cli/behaviour.rs b/swap/src/cli/behaviour.rs index be6596e3..cbd39b27 100644 --- a/swap/src/cli/behaviour.rs +++ b/swap/src/cli/behaviour.rs @@ -78,7 +78,7 @@ impl Behaviour { bitcoin_wallet: Arc, ) -> Self { Self { - quote: quote::bob(), + quote: quote::cli(), swap_setup: bob::Behaviour::new(env_config, bitcoin_wallet), transfer_proof: transfer_proof::bob(), encrypted_signature: encrypted_signature::bob(), diff --git a/swap/src/network/quote.rs b/swap/src/network/quote.rs index 1c78adbe..76c1ffc5 100644 --- a/swap/src/network/quote.rs +++ b/swap/src/network/quote.rs @@ -37,10 +37,11 @@ pub struct BidQuote { pub max_quantity: bitcoin::Amount, } -/// Constructs a new instance of the `quote` behaviour to be used by Alice. +/// Constructs a new instance of the `quote` behaviour to be used by the ASB. /// -/// Alice only supports inbound connections, i.e. handing out quotes. -pub fn alice() -> Behaviour { +/// The ASB is always listening and only supports inbound connections, i.e. +/// handing out quotes. +pub fn asb() -> Behaviour { Behaviour::new( JsonPullCodec::default(), vec![(BidQuoteProtocol, ProtocolSupport::Inbound)], @@ -48,10 +49,11 @@ pub fn alice() -> Behaviour { ) } -/// Constructs a new instance of the `quote` behaviour to be used by Bob. +/// Constructs a new instance of the `quote` behaviour to be used by the CLI. /// -/// Bob only supports outbound connections, i.e. requesting quotes. -pub fn bob() -> Behaviour { +/// The CLI is always dialing and only supports outbound connections, i.e. +/// requesting quotes. +pub fn cli() -> Behaviour { Behaviour::new( JsonPullCodec::default(), vec![(BidQuoteProtocol, ProtocolSupport::Outbound)],