From 2b4f7a546684aa4e5d16353609e5ab961d022ce6 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Sun, 4 Aug 2024 17:28:38 +0200 Subject: [PATCH] map: export gossip types Signed-off-by: Vincenzo Palazzo --- gossip_map/Cargo.toml | 2 +- gossip_map/src/gossip_types.rs | 31 ++++++++++--------------------- gossip_map/src/lib.rs | 2 +- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/gossip_map/Cargo.toml b/gossip_map/Cargo.toml index f9d1a4c..0e6ab63 100644 --- a/gossip_map/Cargo.toml +++ b/gossip_map/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clightningrpc_gossip_map" -version = "0.0.1-beta.3" +version = "0.0.1-beta.5" edition = "2021" description = "Crate that provides a plugin API to give the possibility to implement a plugin in Rust" license = "CC0-1.0" diff --git a/gossip_map/src/gossip_types.rs b/gossip_map/src/gossip_types.rs index fe3c8ea..a842fc6 100644 --- a/gossip_map/src/gossip_types.rs +++ b/gossip_map/src/gossip_types.rs @@ -11,17 +11,6 @@ use fundamentals_derive::DecodeWire; use crate::bolt7::{ChannelAnnouncement, ChannelUpdate, NodeAnnouncement}; use crate::gossip_stor_wiregen::GossipStoreChannelAmount; -trait GossipType { - /// Decode the gossip message from a sequence of bytes. - fn decode(stream: &mut dyn BufRead) -> Result - where - Self: Sized; - - /// Encode the gossip message in a sequence of bytes. - fn encode(&self) -> Bytes; -} - -/// Node Id encoded for the gossip map #[derive(Eq, Hash, PartialEq, Debug, Clone)] pub struct GossipNodeId { pub(crate) node_id: String, @@ -81,16 +70,16 @@ impl GossipNode { /// Channel Information stored inside the Gossip Map. #[derive(Clone)] pub struct GossipChannel { - inner: ChannelAnnouncement, - annound_offset: u32, - scid: ShortChannelId, - node_one: GossipNodeId, - node_two: GossipNodeId, - update_fields: Vec>, - update_offset: Vec, - satoshi: Option, - half_channels: HashMap, - private: bool, + pub inner: ChannelAnnouncement, + pub annound_offset: u32, + pub scid: ShortChannelId, + pub node_one: GossipNodeId, + pub node_two: GossipNodeId, + pub update_fields: Vec>, + pub update_offset: Vec, + pub satoshi: Option, + pub half_channels: HashMap, + pub private: bool, } impl Debug for GossipChannel { diff --git a/gossip_map/src/lib.rs b/gossip_map/src/lib.rs index 595b3a6..3318028 100644 --- a/gossip_map/src/lib.rs +++ b/gossip_map/src/lib.rs @@ -10,7 +10,7 @@ pub use fundamentals::*; mod bolt7; mod flags; mod gossip_stor_wiregen; -mod gossip_types; +pub mod gossip_types; use crate::bolt7::{ChannelAnnouncement, ChannelUpdate, NodeAnnouncement}; use crate::flags::{