Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <[email protected]>
  • Loading branch information
onur-ozkan committed Nov 13, 2024
1 parent 8487ab1 commit faeee43
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mm2src/mm2_p2p/src/behaviours/atomicdex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ const CHANNEL_BUF_SIZE: usize = 1024 * 8;

/// Used in time validation logic for each peer which runs immediately after the
/// `ConnectionEstablished` event.
///
/// Be careful when updating this value, we have some defaults (like for swaps)
/// depending on this.
pub const MAX_TIME_GAP_FOR_CONNECTED_PEER: u64 = 20;

/// Used for storing peers in [`RECENTLY_DIALED_PEERS`].
Expand Down Expand Up @@ -248,7 +251,7 @@ async fn validate_peer_time(peer: PeerId, mut response_tx: Sender<Option<PeerId>

// If time diff is in the acceptable gap, end the validation here.
if diff <= MAX_TIME_GAP_FOR_CONNECTED_PEER {
info!(
debug!(
"Peer '{peer}' is within the acceptable time gap ({MAX_TIME_GAP_FOR_CONNECTED_PEER} seconds); time difference is {diff} seconds."
);
response_tx.send(None).await.unwrap();
Expand All @@ -261,7 +264,7 @@ async fn validate_peer_time(peer: PeerId, mut response_tx: Sender<Option<PeerId>

// If the function reaches this point, this means validation has failed.
// Send the peer ID to disconnect from it.
eprintln!("Failed to validate the time for peer `{peer}`; disconnecting.");
error!("Failed to validate the time for peer `{peer}`; disconnecting.");
response_tx.send(Some(peer)).await.unwrap();
}

Expand Down

0 comments on commit faeee43

Please sign in to comment.