From f3154b242d556046db6717dd4cd8432797ffa872 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 11 Sep 2022 22:39:59 +0000 Subject: [PATCH] Update to LDK 0.0.111, rust-bitcoin 0.29 --- Cargo.toml | 8 ++++---- src/downloader.rs | 17 +++++++++++++---- src/serialization.rs | 3 ++- src/tracking.rs | 2 ++ src/types.rs | 2 +- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d2e1435..79fa1d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,10 +4,10 @@ version = "0.1.0" edition = "2018" [dependencies] -bitcoin = "0.28.1" -lightning = { version = "0.0.110" } -lightning-block-sync = { version = "0.0.110", features=["rest-client"] } -lightning-net-tokio = { version = "0.0.110" } +bitcoin = "0.29" +lightning = { version = "0.0.111" } +lightning-block-sync = { version = "0.0.111", features=["rest-client"] } +lightning-net-tokio = { version = "0.0.111" } tokio = { version = "1.14.1", features = ["full"] } tokio-postgres = { version="0.7.5" } futures = "0.3" diff --git a/src/downloader.rs b/src/downloader.rs index 997e997..504db2a 100644 --- a/src/downloader.rs +++ b/src/downloader.rs @@ -1,6 +1,7 @@ use std::sync::{Arc, RwLock}; use bitcoin::secp256k1::PublicKey; +use lightning::ln::features::{InitFeatures, NodeFeatures}; use lightning::ln::msgs::{ChannelAnnouncement, ChannelUpdate, Init, LightningError, NodeAnnouncement, QueryChannelRange, QueryShortChannelIds, ReplyChannelRange, ReplyShortChannelIdsEnd, RoutingMessageHandler}; use lightning::routing::gossip::{NetworkGraph, P2PGossipSync}; use lightning::util::events::{MessageSendEvent, MessageSendEventsProvider}; @@ -97,12 +98,12 @@ impl RoutingMessageHandler for GossipRouter { Ok(output_value) } - fn get_next_channel_announcements(&self, starting_point: u64, batch_amount: u8) -> Vec<(ChannelAnnouncement, Option, Option)> { - self.native_router.get_next_channel_announcements(starting_point, batch_amount) + fn get_next_channel_announcement(&self, starting_point: u64) -> Option<(ChannelAnnouncement, Option, Option)> { + self.native_router.get_next_channel_announcement(starting_point) } - fn get_next_node_announcements(&self, starting_point: Option<&PublicKey>, batch_amount: u8) -> Vec { - self.native_router.get_next_node_announcements(starting_point, batch_amount) + fn get_next_node_announcement(&self, starting_point: Option<&PublicKey>) -> Option { + self.native_router.get_next_node_announcement(starting_point) } fn peer_connected(&self, their_node_id: &PublicKey, init: &Init) { @@ -124,4 +125,12 @@ impl RoutingMessageHandler for GossipRouter { fn handle_query_short_channel_ids(&self, their_node_id: &PublicKey, msg: QueryShortChannelIds) -> Result<(), LightningError> { self.native_router.handle_query_short_channel_ids(their_node_id, msg) } + + fn provided_init_features(&self, their_node_id: &PublicKey) -> InitFeatures { + self.native_router.provided_init_features(their_node_id) + } + + fn provided_node_features(&self) -> NodeFeatures { + self.native_router.provided_node_features() + } } diff --git a/src/serialization.rs b/src/serialization.rs index 847c754..f7db29d 100644 --- a/src/serialization.rs +++ b/src/serialization.rs @@ -2,6 +2,7 @@ use std::cmp::max; use std::collections::HashMap; use bitcoin::BlockHash; +use bitcoin::hashes::Hash; use lightning::ln::msgs::{UnsignedChannelAnnouncement, UnsignedChannelUpdate}; use lightning::util::ser::{BigSize, Writeable}; @@ -93,7 +94,7 @@ pub(super) fn serialize_delta_set(delta_set: DeltaSet, last_sync_timestamp: u32) announcements: vec![], updates: vec![], full_update_defaults: Default::default(), - chain_hash: Default::default(), + chain_hash: BlockHash::all_zeros(), latest_seen: 0, }; diff --git a/src/tracking.rs b/src/tracking.rs index 83e1887..810a037 100644 --- a/src/tracking.rs +++ b/src/tracking.rs @@ -36,10 +36,12 @@ pub(crate) async fn download_gossip(persistence_sender: mpsc::Sender; -pub(crate) type GossipPeerManager = Arc, TestLogger, IgnoringMessageHandler>>; +pub(crate) type GossipPeerManager = Arc, IgnoringMessageHandler, TestLogger, IgnoringMessageHandler>>; #[derive(Debug)] pub(crate) enum GossipMessage { -- 2.39.5