Skip to content

Commit 497ebe5

Browse files
authored
Merge pull request #89 from arik-so/ldk-0.1-upgrade
Upgrade LDK to 0.1
2 parents 1e54c9c + a4e0b15 commit 497ebe5

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ edition = "2021"
66
[dependencies]
77
bitcoin = "0.32.2"
88
hex-conservative = "0.2.1"
9-
lightning = { version = "0.0.125" }
10-
lightning-block-sync = { version = "0.0.125", features=["rest-client"] }
11-
lightning-net-tokio = { version = "0.0.125" }
9+
lightning = { version = "0.1.0" }
10+
lightning-block-sync = { version = "0.1.0", features=["rest-client"] }
11+
lightning-net-tokio = { version = "0.1.0" }
1212
tokio = { version = "1.25", features = ["full"] }
1313
tokio-postgres = { version = "=0.7.5" }
1414
futures = "0.3"
1515

1616
[dev-dependencies]
17-
lightning = { version = "0.0.125", features = ["_test_utils"] }
18-
lightning-rapid-gossip-sync = { version = "0.0.125" }
17+
lightning = { version = "0.1.0", features = ["_test_utils"] }
18+
lightning-rapid-gossip-sync = { version = "0.1.0" }
1919

2020
[profile.dev]
2121
panic = "abort"

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ pub(crate) async fn upgrade_db<L: Deref + Clone + Send + Sync + 'static>(
337337
let permit = Arc::clone(&sem).acquire_owned().await.unwrap();
338338
let logger = logger.clone();
339339
tokio::spawn(async move {
340-
let rest_client = Arc::new(RestClient::new(bitcoin_rest_endpoint()).unwrap());
340+
let rest_client = Arc::new(RestClient::new(bitcoin_rest_endpoint()));
341341
let txo = ChainVerifier::retrieve_txo(rest_client, scid as u64, logger).await
342342
.expect("We shouldn't have accepted a channel announce with a bad TXO");
343343
let client = crate::connect_to_db().await;

src/downloader.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use std::sync::{Arc, RwLock};
33

44
use bitcoin::secp256k1::PublicKey;
55
use lightning::events::{MessageSendEvent, MessageSendEventsProvider};
6-
use lightning::ln::features::{InitFeatures, NodeFeatures};
76
use lightning::ln::msgs::{ChannelAnnouncement, ChannelUpdate, Init, LightningError, NodeAnnouncement, QueryChannelRange, QueryShortChannelIds, ReplyChannelRange, ReplyShortChannelIdsEnd, RoutingMessageHandler};
87
use lightning::routing::gossip::{NetworkGraph, NodeId, P2PGossipSync};
8+
use lightning::types::features::{InitFeatures, NodeFeatures};
99
use lightning::util::logger::Logger;
1010
use tokio::sync::mpsc;
1111
use tokio::sync::mpsc::error::TrySendError;
@@ -132,20 +132,20 @@ impl<L: Deref + Clone + Send + Sync> MessageSendEventsProvider for GossipRouter<
132132
}
133133

134134
impl<L: Deref + Clone + Send + Sync> RoutingMessageHandler for GossipRouter<L> where L::Target: Logger {
135-
fn handle_node_announcement(&self, msg: &NodeAnnouncement) -> Result<bool, LightningError> {
136-
let res = self.native_router.handle_node_announcement(msg)?;
135+
fn handle_node_announcement(&self, their_node_id: Option<PublicKey>, msg: &NodeAnnouncement) -> Result<bool, LightningError> {
136+
let res = self.native_router.handle_node_announcement(their_node_id, msg)?;
137137
self.new_node_announcement(msg.clone());
138138
Ok(res)
139139
}
140140

141-
fn handle_channel_announcement(&self, msg: &ChannelAnnouncement) -> Result<bool, LightningError> {
142-
let res = self.native_router.handle_channel_announcement(msg)?;
141+
fn handle_channel_announcement(&self, their_node_id: Option<PublicKey>, msg: &ChannelAnnouncement) -> Result<bool, LightningError> {
142+
let res = self.native_router.handle_channel_announcement(their_node_id, msg)?;
143143
self.new_channel_announcement(msg.clone());
144144
Ok(res)
145145
}
146146

147-
fn handle_channel_update(&self, msg: &ChannelUpdate) -> Result<bool, LightningError> {
148-
let res = self.native_router.handle_channel_update(msg)?;
147+
fn handle_channel_update(&self, their_node_id: Option<PublicKey>, msg: &ChannelUpdate) -> Result<bool, LightningError> {
148+
let res = self.native_router.handle_channel_update(their_node_id, msg)?;
149149
self.new_channel_update(msg.clone());
150150
Ok(res)
151151
}
@@ -162,27 +162,27 @@ impl<L: Deref + Clone + Send + Sync> RoutingMessageHandler for GossipRouter<L> w
162162
self.native_router.get_next_node_announcement(starting_point)
163163
}
164164

165-
fn peer_connected(&self, their_node_id: &PublicKey, init: &Init, inbound: bool) -> Result<(), ()> {
165+
fn peer_connected(&self, their_node_id: PublicKey, init: &Init, inbound: bool) -> Result<(), ()> {
166166
self.native_router.peer_connected(their_node_id, init, inbound)
167167
}
168168

169-
fn handle_reply_channel_range(&self, their_node_id: &PublicKey, msg: ReplyChannelRange) -> Result<(), LightningError> {
169+
fn handle_reply_channel_range(&self, their_node_id: PublicKey, msg: ReplyChannelRange) -> Result<(), LightningError> {
170170
self.native_router.handle_reply_channel_range(their_node_id, msg)
171171
}
172172

173-
fn handle_reply_short_channel_ids_end(&self, their_node_id: &PublicKey, msg: ReplyShortChannelIdsEnd) -> Result<(), LightningError> {
173+
fn handle_reply_short_channel_ids_end(&self, their_node_id: PublicKey, msg: ReplyShortChannelIdsEnd) -> Result<(), LightningError> {
174174
self.native_router.handle_reply_short_channel_ids_end(their_node_id, msg)
175175
}
176176

177-
fn handle_query_channel_range(&self, their_node_id: &PublicKey, msg: QueryChannelRange) -> Result<(), LightningError> {
177+
fn handle_query_channel_range(&self, their_node_id: PublicKey, msg: QueryChannelRange) -> Result<(), LightningError> {
178178
self.native_router.handle_query_channel_range(their_node_id, msg)
179179
}
180180

181-
fn handle_query_short_channel_ids(&self, their_node_id: &PublicKey, msg: QueryShortChannelIds) -> Result<(), LightningError> {
181+
fn handle_query_short_channel_ids(&self, their_node_id: PublicKey, msg: QueryShortChannelIds) -> Result<(), LightningError> {
182182
self.native_router.handle_query_short_channel_ids(their_node_id, msg)
183183
}
184184

185-
fn provided_init_features(&self, their_node_id: &PublicKey) -> InitFeatures {
185+
fn provided_init_features(&self, their_node_id: PublicKey) -> InitFeatures {
186186
self.native_router.provided_init_features(their_node_id)
187187
}
188188

src/lookup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use tokio_postgres::Client;
1313
use futures::StreamExt;
1414
use hex_conservative::DisplayHex;
1515
use lightning::{log_debug, log_gossip, log_info};
16-
use lightning::ln::features::NodeFeatures;
16+
use lightning::types::features::NodeFeatures;
1717
use lightning::util::logger::Logger;
1818

1919
use crate::config;

src/serialization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use std::time::{SystemTime, UNIX_EPOCH};
44

55
use bitcoin::Network;
66
use bitcoin::blockdata::constants::ChainHash;
7-
use lightning::ln::features::NodeFeatures;
87
use lightning::ln::msgs::{UnsignedChannelAnnouncement, UnsignedChannelUpdate};
8+
use lightning::types::features::NodeFeatures;
99
use lightning::util::ser::{BigSize, Writeable};
1010
use crate::config;
1111

src/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use bitcoin::secp256k1::{Secp256k1, SecretKey};
1111
use bitcoin::hashes::Hash;
1212
use bitcoin::hashes::sha256d::Hash as Sha256dHash;
1313
use hex_conservative::DisplayHex;
14-
use lightning::ln::features::{ChannelFeatures, NodeFeatures};
1514
use lightning::ln::msgs::{ChannelAnnouncement, ChannelUpdate, NodeAnnouncement, SocketAddress, UnsignedChannelAnnouncement, UnsignedChannelUpdate, UnsignedNodeAnnouncement};
1615
use lightning::routing::gossip::{NetworkGraph, NodeAlias, NodeId};
16+
use lightning::types::features::{ChannelFeatures, NodeFeatures};
1717
use lightning::util::ser::Writeable;
1818
use lightning_rapid_gossip_sync::RapidGossipSync;
1919
use crate::{calculate_delta, config, serialize_delta, serialize_empty_blob};

src/verifier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct RestBinaryResponse(Vec<u8>);
3535
impl<L: Deref + Clone + Send + Sync + 'static> ChainVerifier<L> where L::Target: Logger {
3636
pub(crate) fn new(graph: Arc<NetworkGraph<L>>, outbound_gossiper: Arc<P2PGossipSync<Arc<NetworkGraph<L>>, Arc<Self>, L>>, logger: L) -> Self {
3737
ChainVerifier {
38-
rest_client: Arc::new(RestClient::new(config::bitcoin_rest_endpoint()).unwrap()),
38+
rest_client: Arc::new(RestClient::new(config::bitcoin_rest_endpoint())),
3939
outbound_gossiper,
4040
graph,
4141
peer_handler: Mutex::new(None),

0 commit comments

Comments
 (0)