summaryrefslogtreecommitdiffstats
path: root/lib/src/reactor/gossip/msg.rs
blob: 049fc6818eda694cb60dcc71add1666fbb3bd03c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use anyhow::Result;

#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub enum GossipMessage {
    CurrentProfileState {
        peer_id: Vec<u8>,
        cid: Vec<u8>,
    },
}

impl GossipMessage {
    pub(super) fn into_bytes(self) -> Result<Vec<u8>> {
        serde_json::to_string(&self)
            .map(String::into_bytes)
            .map_err(anyhow::Error::from)
    }
}