Skip to content

Commit

Permalink
Serialize NodePeersQuery according to the specification (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tumas committed Oct 1, 2024
1 parent 27c2053 commit c7c07b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion p2p/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ pub enum ApiToP2p<P: Preset> {
RequestIdentity(#[serde(skip)] Sender<NodeIdentity>),
RequestPeer(PeerId, #[serde(skip)] Sender<Option<NodePeer>>),
RequestPeerCount(#[serde(skip)] Sender<NodePeerCount>),
RequestPeers(NodePeersQuery, #[serde(skip)] Sender<Vec<NodePeer>>),
RequestPeers(
#[serde(skip)] NodePeersQuery,
#[serde(skip)] Sender<Vec<NodePeer>>,
),
}

impl<P: Preset> ApiToP2p<P> {
Expand Down
4 changes: 3 additions & 1 deletion p2p/src/network_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ use types::preset::Preset;

use crate::Network;

#[derive(Deserialize, Serialize)]
#[derive(Deserialize)]
pub struct NodePeersQuery {
#[serde(rename(deserialize = "state"))]
states: Option<Vec<PeerState>>,
#[serde(rename(deserialize = "direction"))]
directions: Option<Vec<PeerDirection>>,
}

Expand Down

0 comments on commit c7c07b2

Please sign in to comment.