Skip to content

Commit

Permalink
review fix: rename const to TAKER_FEE_VALIDATION_RETRY_DELAY_SECS
Browse files Browse the repository at this point in the history
  • Loading branch information
shamardy committed Nov 13, 2024
1 parent b7781b3 commit 515f6ae
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
8 changes: 6 additions & 2 deletions mm2src/coins/utxo/rpc_clients/electrum_rpc/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,15 @@ impl ElectrumConnection {
};

let Some(dns_name) = uri.host().map(String::from) else {
return Err(ElectrumConnectionErr::Irrecoverable("Couldn't retrieve host from address".to_string()));
return Err(ElectrumConnectionErr::Irrecoverable(
"Couldn't retrieve host from address".to_string(),
));
};

let Ok(dns) = server_name_from_domain(dns_name.as_str()) else {
return Err(ElectrumConnectionErr::Irrecoverable("Address isn't a valid domain name".to_string()));
return Err(ElectrumConnectionErr::Irrecoverable(
"Address isn't a valid domain name".to_string(),
));
};

let tls_connector = if connection.settings.disable_cert_verification {
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/lp_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub(crate) const MAKER_SWAP_V2_TYPE: u8 = 1;
pub(crate) const TAKER_SWAP_V2_TYPE: u8 = 2;

pub(crate) const TAKER_FEE_VALIDATION_ATTEMPTS: usize = 6;
pub(crate) const TAKER_FEE_VALIDATION_RETRY_DELAY: f64 = 10.;
pub(crate) const TAKER_FEE_VALIDATION_RETRY_DELAY_SECS: f64 = 10.;

const MAX_STARTED_AT_DIFF: u64 = 60;
const NEGOTIATE_SEND_INTERVAL: f64 = 30.;
Expand Down
4 changes: 2 additions & 2 deletions mm2src/mm2_main/src/lp_swap/maker_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use super::{broadcast_my_swap_status, broadcast_p2p_tx_msg, broadcast_swap_msg_e
NegotiationDataV2, NegotiationDataV3, RecoveredSwap, RecoveredSwapAction, SavedSwap, SavedSwapIo,
SavedTradeFee, SecretHashAlgo, SwapConfirmationsSettings, SwapError, SwapMsg, SwapPubkeys, SwapTxDataMsg,
SwapsContext, TransactionIdentifier, INCLUDE_REFUND_FEE, NO_REFUND_FEE, TAKER_FEE_VALIDATION_ATTEMPTS,
TAKER_FEE_VALIDATION_RETRY_DELAY, WAIT_CONFIRM_INTERVAL_SEC};
TAKER_FEE_VALIDATION_RETRY_DELAY_SECS, WAIT_CONFIRM_INTERVAL_SEC};
use crate::lp_dispatcher::{DispatcherContext, LpEvents};
use crate::lp_network::subscribe_to_topic;
use crate::lp_ordermatch::MakerOrderBuilder;
Expand Down Expand Up @@ -778,7 +778,7 @@ impl MakerSwap {
]));
} else {
attempts += 1;
Timer::sleep(TAKER_FEE_VALIDATION_RETRY_DELAY).await;
Timer::sleep(TAKER_FEE_VALIDATION_RETRY_DELAY_SECS).await;
}
},
};
Expand Down
4 changes: 2 additions & 2 deletions mm2src/mm2_main/src/lp_swap/swap_watcher.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::{broadcast_p2p_tx_msg, get_payment_locktime, lp_coinfind, taker_payment_spend_deadline, tx_helper_topic,
H256Json, SwapsContext, TAKER_FEE_VALIDATION_ATTEMPTS, TAKER_FEE_VALIDATION_RETRY_DELAY,
H256Json, SwapsContext, TAKER_FEE_VALIDATION_ATTEMPTS, TAKER_FEE_VALIDATION_RETRY_DELAY_SECS,
WAIT_CONFIRM_INTERVAL_SEC};
use crate::lp_network::{P2PRequestError, P2PRequestResult};

Expand Down Expand Up @@ -196,7 +196,7 @@ impl State for ValidateTakerFee {
.compat()
.await
})
.repeat_every_secs(TAKER_FEE_VALIDATION_RETRY_DELAY)
.repeat_every_secs(TAKER_FEE_VALIDATION_RETRY_DELAY_SECS)
.attempts(TAKER_FEE_VALIDATION_ATTEMPTS)
.inspect_err(|e| error!("Error validating taker fee: {}", e))
.await;
Expand Down

0 comments on commit 515f6ae

Please sign in to comment.