From cedfe95dbb62b2049c9b6ae32df0e92bd28ca4de Mon Sep 17 00:00:00 2001 From: KnowWhoami Date: Wed, 1 Jan 2025 13:01:34 +0530 Subject: [PATCH] fixes --- directory.toml | 8 +++++-- maker.toml | 40 +++++++++++--------------------- src/bin/directoryd.rs | 7 ++---- src/bin/makerd.rs | 6 +---- src/bin/taker.rs | 14 ++++-------- src/maker/api.rs | 17 ++++++++++---- src/maker/config.rs | 21 ++++++++--------- src/maker/handlers.rs | 13 ++--------- src/maker/rpc/server.rs | 1 - src/maker/server.rs | 2 +- src/protocol/messages.rs | 21 ++++++++--------- src/taker/api.rs | 21 ++++++++--------- src/taker/offers.rs | 6 ++--- src/taker/routines.rs | 2 +- src/utill.rs | 20 ++++++++++------ taker.toml | 49 ++++++++-------------------------------- tests/maker_cli.rs | 2 +- tests/standard_swap.rs | 12 ++++------ 18 files changed, 103 insertions(+), 159 deletions(-) diff --git a/directory.toml b/directory.toml index 49112ba9..5d4cffe3 100644 --- a/directory.toml +++ b/directory.toml @@ -1,4 +1,8 @@ -[directory_config] +# Listening port port = 8080 +# Socks port socks_port = 19060 -connection_type = "tor" \ No newline at end of file +# Connection type +connection_type = TOR +# RPC listening port +rpc_port = 4321 \ No newline at end of file diff --git a/maker.toml b/maker.toml index 12325f5c..b3505a7c 100644 --- a/maker.toml +++ b/maker.toml @@ -1,30 +1,16 @@ -Think about this? -[maker_config] # Listening port port = 6102 -# Time interval between connection checks -heart_beat_interval_secs = 3 -# Time interval to ping the RPC backend -rpc_ping_interval_secs = 60 -# Time interval to ping directory server -# 12 hours = 60*60*12 = 43200 -directory_servers_refresh_interval_secs = 43200 -# Time interval to close a connection if no response is received -idle_connection_timeout = 300 -# Absolute coinswap fee -base_fee_sats = 1000 -# Fee rate per swap amount in ppb. -amount_relative_fee_ppb = 10000000 -# Fee rate for timelocked contract in ppb -time_relative_fee_ppb = 100000 -# No of confirmation required for funding transaction -required_confirms = 1 -# Minimum timelock difference between contract transaction of two hops -min_contract_reaction_time = 48 -# Minimum coinswap amount size in sats -min_size = 10000 +# RPC listening port +rpc_port +# Minimum Coinswap amount +min_swap_amount = 100000 # Socks port -socks_part = 19050 -# Directory server onion address -directory_server_onion_address = "directoryhiddenserviceaddress.onion:8080" -connection_type = "tor" \ No newline at end of file +socks_port = 19050 +# Directory server address +directory_server_address = 127.0.0.1:8080 +# Fidelity Bond amount +fidelity_amount = 5000000 +# Fidelity Bond timelock in Block heights +fidelity_timelock = 26000 +# Connection type +connection_type = TOR \ No newline at end of file diff --git a/src/bin/directoryd.rs b/src/bin/directoryd.rs index 6d3fce88..5cf26de3 100644 --- a/src/bin/directoryd.rs +++ b/src/bin/directoryd.rs @@ -57,11 +57,7 @@ fn main() -> Result<(), DirectoryServerError> { wallet_name: "random".to_string(), // we can put anything here as it will get updated in the init. }; - let conn_type = if cfg!(feature = "integration-test") { - ConnectionType::CLEARNET - } else { - ConnectionType::TOR - }; + let conn_type = ConnectionType::TOR; #[cfg(feature = "tor")] { @@ -69,6 +65,7 @@ fn main() -> Result<(), DirectoryServerError> { setup_mitosis(); } } + let directory = Arc::new(DirectoryServer::new(args.data_directory, Some(conn_type))?); start_directory_server(directory, Some(rpc_config))?; diff --git a/src/bin/makerd.rs b/src/bin/makerd.rs index 905d97ec..160f0c03 100644 --- a/src/bin/makerd.rs +++ b/src/bin/makerd.rs @@ -64,11 +64,7 @@ fn main() -> Result<(), MakerError> { wallet_name: "random".to_string(), // we can put anything here as it will get updated in the init. }; - let conn_type = if cfg!(feature = "integration-test") { - ConnectionType::CLEARNET - } else { - ConnectionType::TOR - }; + let conn_type = ConnectionType::TOR; #[cfg(feature = "tor")] { diff --git a/src/bin/taker.rs b/src/bin/taker.rs index 1c59c560..c89d80bf 100644 --- a/src/bin/taker.rs +++ b/src/bin/taker.rs @@ -3,7 +3,7 @@ use bitcoind::bitcoincore_rpc::{json::ListUnspentResultEntry, Auth}; use clap::Parser; use coinswap::{ taker::{error::TakerError, SwapParams, Taker, TakerBehavior}, - utill::{parse_proxy_auth, setup_taker_logger, ConnectionType}, + utill::{parse_proxy_auth, setup_taker_logger, ConnectionType, REQUIRED_CONFIRMS}, wallet::{Destination, RPCConfig, SendAmount}, }; use log::LevelFilter; @@ -51,9 +51,6 @@ struct Cli { /// Sets the transaction count. #[clap(name = "tx_count", default_value = "3")] pub tx_count: u32, - /// Sets the required on-chain confirmations. - #[clap(name = "required_confirms", default_value = "1000")] - pub required_confirms: u32, /// List of sub commands to process various endpoints of taker cli app. #[clap(subcommand)] command: Commands, @@ -98,11 +95,8 @@ fn main() -> Result<(), TakerError> { let args = Cli::parse(); let rpc_network = bitcoin::Network::from_str(&args.bitcoin_network).unwrap(); - let connection_type = if cfg!(feature = "integration-test") { - ConnectionType::CLEARNET - } else { - ConnectionType::TOR - }; + + let connection_type = ConnectionType::TOR; let rpc_config = RPCConfig { url: args.rpc, @@ -115,7 +109,7 @@ fn main() -> Result<(), TakerError> { send_amount: Amount::from_sat(args.send_amount), maker_count: args.maker_count, tx_count: args.tx_count, - required_confirms: args.required_confirms, + required_confirms: REQUIRED_CONFIRMS, }; let mut taker = Taker::init( diff --git a/src/maker/api.rs b/src/maker/api.rs index 7cd679c8..8e900f19 100644 --- a/src/maker/api.rs +++ b/src/maker/api.rs @@ -12,7 +12,10 @@ use crate::{ messages::{FidelityProof, ReqContractSigsForSender}, Hash160, }, - utill::{get_maker_dir, redeemscript_to_scriptpubkey, ConnectionType, HEART_BEAT_INTERVAL}, + utill::{ + get_maker_dir, redeemscript_to_scriptpubkey, ConnectionType, HEART_BEAT_INTERVAL, + REQUIRED_CONFIRMS, + }, wallet::{RPCConfig, SwapCoin, WalletSwapCoin}, }; use bitcoin::{ @@ -57,9 +60,6 @@ pub const RPC_PING_INTERVAL: Duration = Duration::from_secs(60); /// Maker triggers the recovery mechanism, if Taker is idle for more than 300 secs. pub const IDLE_CONNECTION_TIMEOUT: Duration = Duration::from_secs(300); -/// Number of confirmation required funding transaction. -pub const REQUIRED_CONFIRMS: u32 = 1; - /// The minimum difference in locktime (in blocks) between the incoming and outgoing swaps. /// /// This value specifies the reaction time, in blocks, available to a Maker @@ -591,6 +591,13 @@ pub fn check_for_broadcasted_contracts(maker: Arc) -> Result<(), MakerErr /// Broadcast the contract transactions and claim funds via timelock. pub fn check_for_idle_states(maker: Arc) -> Result<(), MakerError> { let mut bad_ip = Vec::new(); + + let conn_timeout = if cfg!(feature = "integration-test") { + Duration::from_secs(60) + } else { + IDLE_CONNECTION_TIMEOUT + }; + loop { if maker.shutdown.load(Relaxed) { break; @@ -612,7 +619,7 @@ pub fn check_for_idle_states(maker: Arc) -> Result<(), MakerError> { ip, no_response_since ); - if no_response_since > IDLE_CONNECTION_TIMEOUT { + if no_response_since > conn_timeout { log::error!( "[{}] Potential Dropped Connection from {}", maker.config.port, diff --git a/src/maker/config.rs b/src/maker/config.rs index 6612c5b5..c4486a64 100644 --- a/src/maker/config.rs +++ b/src/maker/config.rs @@ -16,14 +16,14 @@ pub struct MakerConfig { pub port: u16, /// RPC listening port pub rpc_port: u16, - /// Minimum swap size. + /// Minimum Coinswap amount pub min_swap_amount: u64, /// Socks port pub socks_port: u16, /// Directory server address (can be clearnet or onion) pub directory_server_address: String, - /// Fidelity Bond Value - pub fidelity_value: u64, + /// Fidelity Bond amount + pub fidelity_amount: u64, /// Fidelity Bond timelock in Block heights. pub fidelity_timelock: u32, /// Connection type @@ -38,8 +38,8 @@ impl Default for MakerConfig { min_swap_amount: MIN_SWAP_AMOUNT, socks_port: 19050, directory_server_address: "127.0.0.1:8080".to_string(), - fidelity_value: 5_000_000, // 5 million sats - fidelity_timelock: 26_000, // Approx 6 months of blocks + fidelity_amount: 5_000_000, // 5 million sats + fidelity_timelock: 26_000, // Approx 6 months of blocks connection_type: { #[cfg(feature = "tor")] { @@ -100,9 +100,9 @@ impl MakerConfig { config_map.get("directory_server_address"), default_config.directory_server_address, ), - fidelity_value: parse_field( - config_map.get("fidelity_value"), - default_config.fidelity_value, + fidelity_amount: parse_field( + config_map.get("fidelity_amount"), + default_config.fidelity_amount, ), fidelity_timelock: parse_field( config_map.get("fidelity_timelock"), @@ -123,7 +123,7 @@ rpc_port = {} min_swap_amount = {} socks_port = {} directory_server_address = {} -fidelity_value = {} +fidelity_amount = {} fidelity_timelock = {} connection_type = {:?}", self.port, @@ -131,7 +131,7 @@ connection_type = {:?}", self.min_swap_amount, self.socks_port, self.directory_server_address, - self.fidelity_value, + self.fidelity_amount, self.fidelity_timelock, self.connection_type, ); @@ -172,7 +172,6 @@ mod tests { port = 6102 rpc_port = 6103 required_confirms = 1 - min_contract_reaction_time = 48 min_swap_amount = 100000 socks_port = 19050 "#; diff --git a/src/maker/handlers.rs b/src/maker/handlers.rs index ecf30a7b..425805fe 100644 --- a/src/maker/handlers.rs +++ b/src/maker/handlers.rs @@ -19,8 +19,7 @@ use bitcoind::bitcoincore_rpc::RpcApi; use super::{ api::{ recover_from_swap, ConnectionState, ExpectedMessage, Maker, MakerBehavior, - AMOUNT_RELATIVE_FEE_PCT, BASE_FEE, MIN_CONTRACT_REACTION_TIME, REQUIRED_CONFIRMS, - TIME_RELATIVE_FEE_PCT, + AMOUNT_RELATIVE_FEE_PCT, BASE_FEE, MIN_CONTRACT_REACTION_TIME, TIME_RELATIVE_FEE_PCT, }, error::MakerError, }; @@ -40,6 +39,7 @@ use crate::{ }, Hash160, }, + utill::REQUIRED_CONFIRMS, wallet::{IncomingSwapCoin, SwapCoin, WalletError, WalletSwapCoin}, }; @@ -236,8 +236,6 @@ impl Maker { if total_funding_amount >= self.config.min_swap_amount && total_funding_amount < self.wallet.read()?.store.offer_maxsize - // TODO: Taker must not be allowed to send the amount beyond this range? - // why can't it be <= ? { log::info!( "[{}] Total Funding Amount = {} | Funding Txids = {:?}", @@ -249,7 +247,6 @@ impl Maker { ContractSigsForSender { sigs }, )) } else { - // Instead , we must create a MakerToTakerMessage variant stating about it rather than giving error back to Maker itself. Err(MakerError::General("not enough funds")) } } @@ -425,12 +422,6 @@ impl Maker { act_funding_txs_fees ); - // log::info!( - // "Refund Tx locktime (blocks) = {} | Total Funding Tx Mining Fees = {} | ", - // message.refund_locktime, - // act_funding_txs_fees - // ); - connection_state.pending_funding_txes = my_funding_txes; connection_state.outgoing_swapcoins = outgoing_swapcoins; diff --git a/src/maker/rpc/server.rs b/src/maker/rpc/server.rs index 036485b0..76ee4acf 100644 --- a/src/maker/rpc/server.rs +++ b/src/maker/rpc/server.rs @@ -208,7 +208,6 @@ pub fn start_rpc_server(maker: Arc) -> Result<(), MakerError> { // do nothing } else { log::error!("Error accepting RPC connection: {:?}", e); - return Err(e.into()); // Why are we returning the error instead of continuing? } } } diff --git a/src/maker/server.rs b/src/maker/server.rs index 47a5979e..3cf7af5c 100644 --- a/src/maker/server.rs +++ b/src/maker/server.rs @@ -211,7 +211,7 @@ fn setup_fidelity_bond(maker: &Arc, maker_address: &str) -> Result<(), Ma *proof = Some(highest_proof); } else { // No bond in the wallet. Lets attempt to create one. - let amount = Amount::from_sat(maker.config.fidelity_value); + let amount = Amount::from_sat(maker.config.fidelity_amount); let current_height = maker .get_wallet() .read()? diff --git a/src/protocol/messages.rs b/src/protocol/messages.rs index 3ad83ee3..b3182431 100644 --- a/src/protocol/messages.rs +++ b/src/protocol/messages.rs @@ -170,14 +170,14 @@ pub struct HashPreimage { } /// Multisig Privatekeys used in the last step of coinswap to perform privatekey handover. -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize, Clone)] pub struct MultisigPrivkey { pub multisig_redeemscript: ScriptBuf, pub key: SecretKey, } /// Message to perform the final Privatekey Handover. This is the last message of the Coinswap Protocol. -#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize)] pub struct PrivKeyHandover { pub multisig_privkeys: Vec, } @@ -221,14 +221,14 @@ impl Display for TakerToMakerMessage { } /// Represents the initial handshake message sent from Maker to Taker. -#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize)] pub struct MakerHello { pub protocol_version_min: u32, pub protocol_version_max: u32, } /// Contains proof data related to fidelity bond. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Hash)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct FidelityProof { pub bond: FidelityBond, pub cert_hash: Hash, @@ -236,7 +236,7 @@ pub struct FidelityProof { } /// Represents an offer in the context of the Coinswap protocol. -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, PartialOrd)] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] pub struct Offer { pub base_fee: u64, // base fee in sats pub amount_relative_fee_pct: f64, // % fee on total amount @@ -248,16 +248,15 @@ pub struct Offer { pub tweakable_point: PublicKey, pub fidelity: FidelityProof, } -// TODO: Should Offer struct use Amount struct instead of u64? /// Contract Tx signatures provided by a Sender of a Coinswap. -#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize)] pub struct ContractSigsForSender { pub sigs: Vec, } /// Contract Tx and extra metadata from a Sender of a Coinswap -#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize)] pub struct SenderContractTxInfo { pub contract_tx: Transaction, pub timelock_pubkey: PublicKey, @@ -269,7 +268,7 @@ pub struct SenderContractTxInfo { /// for the Maker as both Sender and Receiver of Coinswaps. /// /// This message is sent by a Maker after a [`ProofOfFunding`] has been received. -#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize)] pub struct ContractSigsAsRecvrAndSender { /// Contract Tx by which this maker is receiving Coinswap. pub receivers_contract_txs: Vec, @@ -278,13 +277,13 @@ pub struct ContractSigsAsRecvrAndSender { } /// Contract Tx signatures a Maker sends as a Receiver of CoinSwap. -#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize)] pub struct ContractSigsForRecvr { pub sigs: Vec, } /// All messages sent from Maker to Taker. -#[derive(Debug, Serialize, Deserialize, PartialEq)] // why do we require PartialEq? +#[derive(Debug, Serialize, Deserialize)] pub enum MakerToTakerMessage { /// Protocol Handshake. MakerHello(MakerHello), diff --git a/src/taker/api.rs b/src/taker/api.rs index 14bfe315..59665673 100644 --- a/src/taker/api.rs +++ b/src/taker/api.rs @@ -12,7 +12,7 @@ use std::{ collections::{HashMap, HashSet}, net::TcpStream, path::PathBuf, - thread::{self, sleep}, + thread::sleep, time::{Duration, Instant}, }; @@ -174,7 +174,7 @@ impl Taker { /// ### Parameters: /// - `data_dir`: /// - `Some(value)`: Use the specified directory for storing data. - /// - `None`: Use the default data directory (e.g., for Linux: `~/.coinswap/maker`). + /// - `None`: Use the default data directory (e.g., for Linux: `~/.coinswap/taker`). /// - `wallet_file_name`: /// - `Some(value)`: Attempt to load a wallet file named `value`. If it does not exist, a new wallet with the given name will be created. /// - `None`: Create a new wallet file with the default name `maker-wallet`. @@ -263,15 +263,13 @@ impl Taker { "/tmp/tor-rust-taker".to_string(), )); - thread::sleep(Duration::from_secs(10)); // Think about this? + // wait for tor process to create a new log file. + std::thread::sleep(Duration::from_secs(3)); - // when we are getting error while reading the file -> how can we say that taker tor is started? if let Err(e) = monitor_log_for_completion(&PathBuf::from(tor_log_dir), "100%") { - log::error!("Error monitoring taker log file: {}", e); + log::error!("Error monitoring taker log file: {}\n Try removing the tor directory and retry", e); + return Err(TakerError::IO(e)); } - - // TODO: Think about here? - log::info!("Taker tor is instantiated"); } } @@ -451,7 +449,7 @@ impl Taker { // Loop until we find a live maker who responded to our signature request. let (maker, funding_txs) = loop { // Fail early if not enough good makers in the list to satisfy swap requirements. - let untried_maker_count = self.offerbook.get_all_untried().len(); //TODO: why we want to remove good makers? + let untried_maker_count = self.offerbook.get_all_untried().len(); if untried_maker_count < (self.ongoing_swap_state.swap_params.maker_count) { log::error!("Not enough makers to satisfy swap requirements."); @@ -859,7 +857,6 @@ impl Taker { maker_refund_locktime: u16, funding_tx_infos: &[FundingTxInfo], ) -> Result<(NextPeerInfo, ContractSigsAsRecvrAndSender), TakerError> { - // TODO: WHy we are using this api two times. let this_maker = &self .ongoing_swap_state .peer_infos @@ -875,7 +872,7 @@ impl Taker { ); let address = this_maker.address.to_string(); let mut socket = match self.config.connection_type { - ConnectionType::CLEARNET => TcpStream::connect(address)?, // Why we give return here instead of trying again? + ConnectionType::CLEARNET => TcpStream::connect(address)?, #[cfg(feature = "tor")] ConnectionType::TOR => Socks5Stream::connect( format!("127.0.0.1:{}", self.config.socks_port).as_str(), @@ -1700,7 +1697,7 @@ impl Taker { .get_all_untried() .iter() .find(|oa| { - send_amount > Amount::from_sat(oa.offer.min_size) + send_amount >= Amount::from_sat(oa.offer.min_size) && send_amount < Amount::from_sat(oa.offer.max_size) && !self .ongoing_swap_state diff --git a/src/taker/offers.rs b/src/taker/offers.rs index 47df06ba..beaa6b77 100644 --- a/src/taker/offers.rs +++ b/src/taker/offers.rs @@ -28,7 +28,7 @@ use crate::{ use super::{config::TakerConfig, error::TakerError, routines::download_maker_offer}; /// Represents an offer along with the corresponding maker address. -#[derive(Debug, Clone, PartialEq, PartialOrd)] +#[derive(Debug, Clone, PartialEq)] pub struct OfferAndAddress { pub offer: Offer, pub address: MakerAddress, @@ -175,7 +175,7 @@ pub fn fetch_offer_from_makers( /// Retrieves advertised maker addresses from directory servers based on the specified network. pub fn fetch_addresses_from_dns( - socks_port: Option, + _socks_port: Option, directory_server_address: String, connection_type: ConnectionType, ) -> Result, TakerError> { @@ -186,7 +186,7 @@ pub fn fetch_addresses_from_dns( ConnectionType::CLEARNET => TcpStream::connect(directory_server_address.as_str())?, #[cfg(feature = "tor")] ConnectionType::TOR => { - let socket_addrs = format!("127.0.0.1:{}", socks_port.expect("Tor port expected")); + let socket_addrs = format!("127.0.0.1:{}", _socks_port.expect("Tor port expected")); Socks5Stream::connect(socket_addrs, directory_server_address.as_str())?.into_inner() } }; diff --git a/src/taker/routines.rs b/src/taker/routines.rs index 3beed557..1ee71a09 100644 --- a/src/taker/routines.rs +++ b/src/taker/routines.rs @@ -358,7 +358,7 @@ pub(crate) fn send_proof_of_funding_and_init_next_hop( } log::info!( - "Maker Received ={} | Maker is Forwarding = {} | Coinswap Fees = {} | Miner Fees paid by us={} ", + "Maker Received = {} | Maker is Forwarding = {} | Coinswap Fees = {} | Miner Fees paid by us = {} ", Amount::from_sat(this_amount), next_amount, Amount::from_sat(coinswap_fees), diff --git a/src/utill.rs b/src/utill.rs index d06d2993..057f1020 100644 --- a/src/utill.rs +++ b/src/utill.rs @@ -58,6 +58,9 @@ pub const GLOBAL_PAUSE: Duration = Duration::from_secs(10); /// Global heartbeat interval used during waiting periods in critical situations. pub const HEART_BEAT_INTERVAL: Duration = Duration::from_secs(3); +/// Number of confirmation required funding transaction. +pub const REQUIRED_CONFIRMS: u32 = 1; + #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ConnectionType { #[cfg(feature = "tor")] @@ -588,17 +591,20 @@ mod tests { protocol_version_min: 1, protocol_version_max: 100, }); + thread::spawn(move || { let (mut socket, _) = listener.accept().unwrap(); let msg_bytes = read_message(&mut socket).unwrap(); let msg: MakerToTakerMessage = serde_cbor::from_slice(&msg_bytes).unwrap(); - assert_eq!( - msg, - MakerToTakerMessage::MakerHello(MakerHello { - protocol_version_min: 1, - protocol_version_max: 100 - }) - ); + + if let MakerToTakerMessage::MakerHello(hello) = msg { + assert!(hello.protocol_version_min == 1 && hello.protocol_version_max == 100); + } else { + panic!( + "Received Wrong Message: Expected MakerHello variant, Got: {:?}", + msg, + ); + } }); let mut stream = TcpStream::connect(address).unwrap(); diff --git a/taker.toml b/taker.toml index 79d94d63..af140627 100644 --- a/taker.toml +++ b/taker.toml @@ -1,39 +1,10 @@ -[taker_config] -# relatively low value for now so that its easier to test without having to wait too much -# right now only the very brave will try coinswap out on mainnet with non-trivial amounts - -#in blocks -refund_locktime = 48 -#in blocks -refund_locktime_step = 48 - -# first connect means the first time you're ever connecting, without having gotten any txes -# confirmed yet, so the taker will not be very persistent since there should be plenty of other -# makers out there -# but also it should allow for flaky connections, otherwise you exclude raspberry pi nodes running -# in people's closets, which are very important for decentralization - -first_connect_attempts = 5 -first_connect_sleep_delay_sec = 1 -first_connect_attempt_timeout_sec = 60 - -# reconnect means when connecting to a maker again after having already gotten txes confirmed -# as it would be a waste of miner fees to give up, the taker is coded to be very persistent -# taker will first attempt to connect with a short delay between attempts -# after that will attempt to connect with a longer delay between attempts -# these figures imply that taker will attempt to connect for just over 48 hours -# of course the user can ctrl+c before then if they give up themselves - -reconnect_attempts = 3200 -reconnect_short_sleep_delay = 10 -reconnect_long_sleep_delay = 60 -# after this many attempts, switch to sleeping longer -short_long_sleep_delay_transition = 60 -reconnect_attempt_timeout_sec = 300 - -# tor configuration -tor_port = 8000 -socks_port = 19050 -# Directory server onion address -directory_server_onion_address = "directoryhiddenserviceaddress.onion:8080" -connection_type = "tor" \ No newline at end of file +# Network listening port +port= 8000, +#Socks port +socks_port= 19070, +# Directory server address +directory_server_address=directoryhiddenserviceaddress.onion:8080 , +# Connection type +connection_type= TOR, +# RPC port +rpc_port= 8081, \ No newline at end of file diff --git a/tests/maker_cli.rs b/tests/maker_cli.rs index 0cd4c572..9130994f 100644 --- a/tests/maker_cli.rs +++ b/tests/maker_cli.rs @@ -158,7 +158,7 @@ fn test_maker_cli() { // Tor address check let tor_addr = maker_cli.execute_maker_cli(&["get-tor-address"]); await_message(&rx, "RPC request received: GetTorAddress"); - assert_eq!(tor_addr, "Maker is not running on TOR"); + assert!(tor_addr.contains("onion:6102")); // Initial Balance checks let seed_balance = maker_cli.execute_maker_cli(&["seed-balance"]); diff --git a/tests/standard_swap.rs b/tests/standard_swap.rs index 864b8c39..e70194a7 100644 --- a/tests/standard_swap.rs +++ b/tests/standard_swap.rs @@ -28,13 +28,11 @@ fn test_standard_coinswap() { ((16102, Some(19052)), MakerBehavior::Normal), ]; - // let connection_type = if cfg!(target_os = "macos") { - // ConnectionType::CLEARNET - // } else { - // ConnectionType::TOR - // }; - - let connection_type = ConnectionType::CLEARNET; + let connection_type = if cfg!(target_os = "macos") { + ConnectionType::CLEARNET + } else { + ConnectionType::TOR + }; // Initiate test framework, Makers and a Taker with default behavior. let (test_framework, mut taker, makers, directory_server_instance, block_generation_handle) =