Skip to content

Commit

Permalink
map: export gossip types
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo committed Aug 4, 2024
1 parent 0d41a33 commit 2b4f7a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion gossip_map/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
31 changes: 10 additions & 21 deletions gossip_map/src/gossip_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self, std::io::Error>
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,
Expand Down Expand Up @@ -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<HashMap<String, String>>,
update_offset: Vec<u32>,
satoshi: Option<u64>,
half_channels: HashMap<u8, GossipPartialChannel>,
private: bool,
pub inner: ChannelAnnouncement,
pub annound_offset: u32,
pub scid: ShortChannelId,
pub node_one: GossipNodeId,
pub node_two: GossipNodeId,
pub update_fields: Vec<HashMap<String, String>>,
pub update_offset: Vec<u32>,
pub satoshi: Option<u64>,
pub half_channels: HashMap<u8, GossipPartialChannel>,
pub private: bool,
}

impl Debug for GossipChannel {
Expand Down
2 changes: 1 addition & 1 deletion gossip_map/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down

0 comments on commit 2b4f7a5

Please sign in to comment.