Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into fix-nft-tx-history-pri…
Browse files Browse the repository at this point in the history
…mkey
  • Loading branch information
laruh committed Sep 12, 2024
2 parents 2bdee4f + d1a8ea7 commit 416b23c
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion mm2src/coins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ mm2_event_stream = { path = "../mm2_event_stream" }
mm2_git = { path = "../mm2_git" }
mm2_io = { path = "../mm2_io" }
mm2_metrics = { path = "../mm2_metrics" }
mm2_net = { path = "../mm2_net" }
mm2_net = { path = "../mm2_net", features = ["p2p"] }
mm2_number = { path = "../mm2_number"}
mm2_rpc = { path = "../mm2_rpc" }
mm2_state_machine = { path = "../mm2_state_machine" }
Expand Down
5 changes: 0 additions & 5 deletions mm2src/mm2_bin_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ authors = ["James Lee", "Artem Pikulin", "Artem Grinblat", "Omar S.", "Onur Ozka
edition = "2018"
default-run = "kdf"

# wasm-opt reduces the size from 17 Mb to 14. But it runs for few minutes, which is not good for CI.
# For production builds, it's recommended to run wasm-opt separately.
[package.metadata.wasm-pack.profile.release]
wasm-opt = false

[features]
custom-swap-locktime = ["mm2_main/custom-swap-locktime"] # only for testing purposes, should never be activated on release builds.
native = ["mm2_main/native"] # Deprecated
Expand Down
4 changes: 2 additions & 2 deletions mm2src/mm2_libp2p/src/atomicdex_behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const ANNOUNCE_INTERVAL: Duration = Duration::from_secs(600);
const ANNOUNCE_INITIAL_DELAY: Duration = Duration::from_secs(60);
const CHANNEL_BUF_SIZE: usize = 1024 * 8;

/// Returns info about connected peers
pub async fn get_peers_info(mut cmd_tx: AdexCmdTx) -> BTreeMap<String, Vec<String>> {
/// Returns info about directly connected peers.
pub async fn get_directly_connected_peers(mut cmd_tx: AdexCmdTx) -> BTreeMap<String, Vec<String>> {
let (result_tx, rx) = oneshot::channel();
let cmd = AdexBehaviourCmd::GetPeersInfo { result_tx };
cmd_tx.send(cmd).await.expect("Rx should be present");
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/rpc/dispatcher/dispatcher_legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ pub fn dispatcher(req: Json, ctx: MmArc) -> DispatcherRes {
"electrum" => hyres(electrum(ctx, req)),
"enable" => hyres(enable(ctx, req)),
"get_enabled_coins" => hyres(get_enabled_coins(ctx)),
"get_directly_connected_peers" => hyres(get_directly_connected_peers(ctx)),
"get_gossip_mesh" => hyres(get_gossip_mesh(ctx)),
"get_gossip_peer_topics" => hyres(get_gossip_peer_topics(ctx)),
"get_gossip_topic_peers" => hyres(get_gossip_topic_peers(ctx)),
"get_my_peer_id" => hyres(get_my_peer_id(ctx)),
"get_peers_info" => hyres(get_peers_info(ctx)),
"get_relay_mesh" => hyres(get_relay_mesh(ctx)),
"get_trade_fee" => hyres(get_trade_fee(ctx, req)),
// "fundvalue" => lp_fundvalue (ctx, req, false),
Expand Down
4 changes: 2 additions & 2 deletions mm2src/mm2_main/src/rpc/lp_commands/lp_commands_legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,10 @@ pub fn version(ctx: MmArc) -> HyRes {
}
}

pub async fn get_peers_info(ctx: MmArc) -> Result<Response<Vec<u8>>, String> {
pub async fn get_directly_connected_peers(ctx: MmArc) -> Result<Response<Vec<u8>>, String> {
let ctx = P2PContext::fetch_from_mm_arc(&ctx);
let cmd_tx = ctx.cmd_tx.lock().clone();
let result = mm2_libp2p::get_peers_info(cmd_tx).await;
let result = mm2_libp2p::get_directly_connected_peers(cmd_tx).await;
let result = json!({
"result": result,
});
Expand Down
4 changes: 2 additions & 2 deletions mm2src/mm2_net/src/network_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ impl EventBehaviour for NetworkEvent {
loop {
let p2p_cmd_tx = p2p_ctx.cmd_tx.lock().clone();

let peers_info = atomicdex::get_peers_info(p2p_cmd_tx.clone()).await;
let directly_connected_peers = atomicdex::get_directly_connected_peers(p2p_cmd_tx.clone()).await;
let gossip_mesh = atomicdex::get_gossip_mesh(p2p_cmd_tx.clone()).await;
let gossip_peer_topics = atomicdex::get_gossip_peer_topics(p2p_cmd_tx.clone()).await;
let gossip_topic_peers = atomicdex::get_gossip_topic_peers(p2p_cmd_tx.clone()).await;
let relay_mesh = atomicdex::get_relay_mesh(p2p_cmd_tx).await;

let event_data = json!({
"peers_info": peers_info,
"directly_connected_peers": directly_connected_peers,
"gossip_mesh": gossip_mesh,
"gossip_peer_topics": gossip_peer_topics,
"gossip_topic_peers": gossip_topic_peers,
Expand Down
4 changes: 2 additions & 2 deletions mm2src/mm2_p2p/src/behaviours/atomicdex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ pub enum AdexBehaviourCmd {
},
}

/// Returns info about connected peers
pub async fn get_peers_info(mut cmd_tx: AdexCmdTx) -> HashMap<String, Vec<String>> {
/// Returns info about directly connected peers.
pub async fn get_directly_connected_peers(mut cmd_tx: AdexCmdTx) -> HashMap<String, Vec<String>> {
let (result_tx, rx) = oneshot::channel();
let cmd = AdexBehaviourCmd::GetPeersInfo { result_tx };
cmd_tx.send(cmd).await.expect("Rx should be present");
Expand Down
9 changes: 5 additions & 4 deletions mm2src/mm2_p2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ use sha2::{Digest, Sha256};
pub use crate::swarm_runtime::SwarmRuntime;

// atomicdex related re-exports
pub use behaviours::atomicdex::{get_gossip_mesh, get_gossip_peer_topics, get_gossip_topic_peers, get_peers_info,
get_relay_mesh, spawn_gossipsub, AdexBehaviourCmd, AdexBehaviourError,
AdexBehaviourEvent, AdexCmdTx, AdexEventRx, AdexResponse, AdexResponseChannel,
GossipsubEvent, GossipsubMessage, MessageId, NodeType, TopicHash, WssCerts};
pub use behaviours::atomicdex::{get_directly_connected_peers, get_gossip_mesh, get_gossip_peer_topics,
get_gossip_topic_peers, get_relay_mesh, spawn_gossipsub, AdexBehaviourCmd,
AdexBehaviourError, AdexBehaviourEvent, AdexCmdTx, AdexEventRx, AdexResponse,
AdexResponseChannel, GossipsubEvent, GossipsubMessage, MessageId, NodeType, TopicHash,
WssCerts};

// peers-exchange re-exports
pub use behaviours::peers_exchange::PeerAddresses;
Expand Down

0 comments on commit 416b23c

Please sign in to comment.