mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Remove rendezvous point default
This also fixes a bug where an empty string wasn't actually allowed as a rendezvous point in the ASB's initial setup wizard.
This commit is contained in:
parent
3e3015a478
commit
d21bd556ec
@ -1,6 +1,5 @@
|
||||
use crate::env::{Mainnet, Testnet};
|
||||
use crate::fs::{ensure_directory_exists, system_config_dir, system_data_dir};
|
||||
use crate::network::rendezvous::DEFAULT_RENDEZVOUS_ADDRESS;
|
||||
use crate::tor::{DEFAULT_CONTROL_PORT, DEFAULT_SOCKS5_PORT};
|
||||
use anyhow::{bail, Context, Result};
|
||||
use config::ConfigError;
|
||||
@ -249,7 +248,7 @@ pub fn query_user_for_initial_config(testnet: bool) -> Result<Config> {
|
||||
.map(|str| str.parse())
|
||||
.collect::<Result<Vec<Multiaddr>, _>>()?;
|
||||
|
||||
let electrum_rpc_url: Url = Input::with_theme(&ColorfulTheme::default())
|
||||
let electrum_rpc_url = Input::with_theme(&ColorfulTheme::default())
|
||||
.with_prompt("Enter Electrum RPC URL or hit return to use default")
|
||||
.default(defaults.electrum_rpc_url)
|
||||
.interact_text()?;
|
||||
@ -290,24 +289,22 @@ pub fn query_user_for_initial_config(testnet: bool) -> Result<Config> {
|
||||
}
|
||||
let ask_spread = Decimal::from_f64(ask_spread).context("Unable to parse spread")?;
|
||||
|
||||
let rendezvous_address = Input::with_theme(&ColorfulTheme::default())
|
||||
let rendezvous_point = Input::<Multiaddr>::with_theme(&ColorfulTheme::default())
|
||||
.with_prompt("Do you want to advertise your ASB instance with a rendezvous node? Enter an empty string if not.")
|
||||
.default(DEFAULT_RENDEZVOUS_ADDRESS.to_string())
|
||||
.allow_empty(true)
|
||||
.interact_text()?;
|
||||
|
||||
let rendezvous_point = if rendezvous_address.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(Multiaddr::from_str(&rendezvous_address)?)
|
||||
};
|
||||
|
||||
println!();
|
||||
|
||||
Ok(Config {
|
||||
data: Data { dir: data_dir },
|
||||
network: Network {
|
||||
listen: listen_addresses,
|
||||
rendezvous_point,
|
||||
rendezvous_point: if rendezvous_point.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(rendezvous_point)
|
||||
},
|
||||
external_addresses: vec![],
|
||||
},
|
||||
bitcoin: Bitcoin {
|
||||
@ -358,7 +355,7 @@ mod tests {
|
||||
},
|
||||
network: Network {
|
||||
listen: vec![defaults.listen_address_tcp, defaults.listen_address_ws],
|
||||
rendezvous_point: Some(DEFAULT_RENDEZVOUS_ADDRESS.parse().unwrap()),
|
||||
rendezvous_point: None,
|
||||
external_addresses: vec![],
|
||||
},
|
||||
|
||||
@ -401,7 +398,7 @@ mod tests {
|
||||
},
|
||||
network: Network {
|
||||
listen: vec![defaults.listen_address_tcp, defaults.listen_address_ws],
|
||||
rendezvous_point: Some(DEFAULT_RENDEZVOUS_ADDRESS.parse().unwrap()),
|
||||
rendezvous_point: None,
|
||||
external_addresses: vec![],
|
||||
},
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::env::GetConfig;
|
||||
use crate::fs::system_data_dir;
|
||||
use crate::network::rendezvous::{XmrBtcNamespace, DEFAULT_RENDEZVOUS_ADDRESS};
|
||||
use crate::network::rendezvous::XmrBtcNamespace;
|
||||
use crate::{env, monero};
|
||||
use anyhow::{Context, Result};
|
||||
use bitcoin::AddressType;
|
||||
@ -336,8 +336,7 @@ enum RawCommand {
|
||||
ListSellers {
|
||||
#[structopt(
|
||||
long,
|
||||
help = "Address of the rendezvous point you want to use to discover ASBs",
|
||||
default_value = DEFAULT_RENDEZVOUS_ADDRESS
|
||||
help = "Address of the rendezvous point you want to use to discover ASBs"
|
||||
)]
|
||||
rendezvous_point: Multiaddr,
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
use libp2p::rendezvous::Namespace;
|
||||
use std::fmt;
|
||||
|
||||
pub const DEFAULT_RENDEZVOUS_ADDRESS: &str =
|
||||
"/dnsaddr/rendezvous.coblox.tech/p2p/12D3KooWQUt9DkNZxEn2R5ymJzWj15MpG6mTW84kyd8vDaRZi46o";
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||
pub enum XmrBtcNamespace {
|
||||
Mainnet,
|
||||
|
Loading…
Reference in New Issue
Block a user