Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map: export gossip types #135

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -1,7 +1,7 @@
//! Gossip map types implementations.
use std::fmt::Debug;
use std::io::Read;
use std::{collections::HashMap, io::BufRead, str::Bytes, vec::Vec};

Check warning on line 4 in gossip_map/src/gossip_types.rs

View workflow job for this annotation

GitHub Actions / Build (beta)

unused imports: `io::BufRead` and `str::Bytes`

Check warning on line 4 in gossip_map/src/gossip_types.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

unused imports: `io::BufRead` and `str::Bytes`

Check warning on line 4 in gossip_map/src/gossip_types.rs

View workflow job for this annotation

GitHub Actions / Build (beta)

unused imports: `io::BufRead` and `str::Bytes`

Check warning on line 4 in gossip_map/src/gossip_types.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

unused imports: `io::BufRead` and `str::Bytes`

Check warning on line 4 in gossip_map/src/gossip_types.rs

View workflow job for this annotation

GitHub Actions / Build (nightly)

unused imports: `io::BufRead` and `str::Bytes`

Check warning on line 4 in gossip_map/src/gossip_types.rs

View workflow job for this annotation

GitHub Actions / Build (nightly)

unused imports: `io::BufRead` and `str::Bytes`

use bitcoin::PublicKey;
use fundamentals::core::FromWire;
Expand All @@ -11,17 +11,6 @@
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 @@
/// 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 @@
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 All @@ -28,7 +28,7 @@
#[derive(Debug)]
pub struct GossipMap {
path: Option<String>,
stream: Option<BufReader<File>>,

Check warning on line 31 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (beta)

field `stream` is never read

Check warning on line 31 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

field `stream` is never read

Check warning on line 31 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (beta)

field `stream` is never read

Check warning on line 31 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

field `stream` is never read

Check warning on line 31 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (nightly)

field `stream` is never read

Check warning on line 31 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (nightly)

field `stream` is never read
pub version: u8,
pub nodes: HashMap<GossipNodeId, GossipNode>,
pub channels: HashMap<ShortChannelId, GossipChannel>,
Expand Down Expand Up @@ -75,12 +75,12 @@
}

/// add a node announcement message inside the gossip map
fn add_node_announcement(&mut self, node_announce: NodeAnnouncement) {

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (beta)

unused variable: `node_announce`

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (beta)

methods `add_node_announcement` and `add_channel_announcement` are never used

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

unused variable: `node_announce`

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (beta)

unused variable: `node_announce`

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

methods `add_node_announcement` and `add_channel_announcement` are never used

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (beta)

methods `add_node_announcement` and `add_channel_announcement` are never used

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

unused variable: `node_announce`

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

methods `add_node_announcement` and `add_channel_announcement` are never used

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (nightly)

unused variable: `node_announce`

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (nightly)

methods `add_node_announcement` and `add_channel_announcement` are never used

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (nightly)

unused variable: `node_announce`

Check warning on line 78 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (nightly)

methods `add_node_announcement` and `add_channel_announcement` are never used
unimplemented!()
}

/// add a channel announcement message inside the gossip map.
fn add_channel_announcement(&mut self, channel_announce: ChannelAnnouncement) {

Check warning on line 83 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (beta)

unused variable: `channel_announce`

Check warning on line 83 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

unused variable: `channel_announce`

Check warning on line 83 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (beta)

unused variable: `channel_announce`

Check warning on line 83 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

unused variable: `channel_announce`

Check warning on line 83 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (nightly)

unused variable: `channel_announce`

Check warning on line 83 in gossip_map/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (nightly)

unused variable: `channel_announce`
unimplemented!()
}

Expand Down
Loading