]> git.bitcoin.ninja Git - rapid-gossip-sync-server/commitdiff
Bump LDK to 0.0.121/rust-bitcoin 0.30, bumping MSRV to 1.63
authorMatt Corallo <git@bluematt.me>
Wed, 13 Mar 2024 14:28:26 +0000 (14:28 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 23 Mar 2024 21:26:13 +0000 (21:26 +0000)
Co-authored-by: Arik Sosman <git@arik.io>
.github/workflows/build.yml
Cargo.toml
src/config.rs
src/tests/mod.rs
src/tracking.rs
src/types.rs

index 7a614ec4ed82e170c83e987953188413ec5f62aa..33d52399db50c819a3428c8fadab94b5bc1e9046 100644 (file)
@@ -18,7 +18,7 @@ jobs:
       matrix:
         toolchain:
           - stable
-          - 1.56.0
+          - 1.63.0
           - beta
     runs-on: ubuntu-latest
     steps:
index 7e6ce0fd110c154d56705a93de8940cb199a9e71..ee31730bff17937322020a763a334313e8c04242 100644 (file)
@@ -4,17 +4,18 @@ version = "0.1.0"
 edition = "2021"
 
 [dependencies]
-bitcoin = "0.29"
-lightning = { version = "0.0.118" }
-lightning-block-sync = { version = "0.0.118", features=["rest-client"] }
-lightning-net-tokio = { version = "0.0.118" }
+bitcoin = "0.30"
+hex-conservative = "0.2"
+lightning = { version = "0.0.121" }
+lightning-block-sync = { version = "0.0.121", features=["rest-client"] }
+lightning-net-tokio = { version = "0.0.121" }
 tokio = { version = "1.25", features = ["full"] }
 tokio-postgres = { version = "=0.7.5" }
 futures = "0.3"
 
 [dev-dependencies]
-lightning = { version = "0.0.118", features = ["_test_utils"] }
-lightning-rapid-gossip-sync = { version = "0.0.118" }
+lightning = { version = "0.0.121", features = ["_test_utils"] }
+lightning-rapid-gossip-sync = { version = "0.0.121" }
 
 [profile.dev]
 panic = "abort"
index 4318a72ca8b65a41e5207a083dbff8491dbcf408..ae5b2d116142b7c035f0af446a97f59ea446a680 100644 (file)
@@ -336,24 +336,33 @@ fn resolve_peer_info(peer_info: &str) -> Result<(PublicKey, SocketAddr), &str> {
 #[cfg(test)]
 mod tests {
        use super::*;
-       use bitcoin::hashes::hex::ToHex;
+       use hex_conservative::DisplayHex;
        use std::str::FromStr;
 
        #[test]
        fn test_resolve_peer_info() {
                let wallet_of_satoshi = "035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735";
                let (pubkey, socket_address) = resolve_peer_info(wallet_of_satoshi).unwrap();
-               assert_eq!(pubkey.serialize().to_hex(), "035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226");
+               assert_eq!(
+                       pubkey.serialize().to_lower_hex_string(),
+                       "035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226"
+               );
                assert_eq!(socket_address.to_string(), "170.75.163.209:9735");
 
                let ipv6 = "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025@[2001:db8::1]:80";
                let (pubkey, socket_address) = resolve_peer_info(ipv6).unwrap();
-               assert_eq!(pubkey.serialize().to_hex(), "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025");
+               assert_eq!(
+                       pubkey.serialize().to_lower_hex_string(),
+                       "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025"
+               );
                assert_eq!(socket_address.to_string(), "[2001:db8::1]:80");
 
                let localhost = "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025@localhost:9735";
                let (pubkey, socket_address) = resolve_peer_info(localhost).unwrap();
-               assert_eq!(pubkey.serialize().to_hex(), "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025");
+               assert_eq!(
+                       pubkey.serialize().to_lower_hex_string(),
+                       "033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025"
+               );
                let socket_address = socket_address.to_string();
                assert!(socket_address == "127.0.0.1:9735" || socket_address == "[::1]:9735");
        }
index ef25ef0782d947c1e591a1cd348c6b39c1e80fb4..cbacca66e4a00d75ae828788aad2f7013cec4347 100644 (file)
@@ -9,8 +9,8 @@ use bitcoin::Network;
 use bitcoin::secp256k1::ecdsa::Signature;
 use bitcoin::secp256k1::{Secp256k1, SecretKey};
 use bitcoin::hashes::Hash;
-use bitcoin::hashes::hex::ToHex;
 use bitcoin::hashes::sha256d::Hash as Sha256dHash;
+use hex_conservative::DisplayHex;
 use lightning::ln::features::ChannelFeatures;
 use lightning::ln::msgs::{ChannelAnnouncement, ChannelUpdate, UnsignedChannelAnnouncement, UnsignedChannelUpdate};
 use lightning::routing::gossip::{NetworkGraph, NodeId};
@@ -121,9 +121,9 @@ impl SchemaSanitizer {
                        let thread_id = thread::current().id();
                        let preimage = format!("{:?}-{}", thread_id, timestamp_nanos);
                        println!("test schema preimage: {}", preimage);
-                       let suffix = Sha256dHash::hash(preimage.as_bytes()).into_inner().to_hex();
+                       let suffix = Sha256dHash::hash(preimage.as_bytes()).encode();
                        // the schema must start with a letter
-                       let schema = format!("test_{}_{}", timestamp_seconds, suffix);
+                       let schema = format!("test_{}_{}", timestamp_seconds, suffix.as_hex());
                        *suffix_option = Some(schema);
                });
 
index c8d6bac888bf5f292ad624d6e521cc3623dfd561..901339c3286ad22d156f5b5d85c486377d2027b4 100644 (file)
@@ -5,8 +5,8 @@ use std::ops::Deref;
 use std::sync::Arc;
 use std::time::{Duration, Instant};
 
-use bitcoin::hashes::hex::ToHex;
 use bitcoin::secp256k1::PublicKey;
+use hex_conservative::display::DisplayHex;
 use lightning::ln::peer_handler::{
        ErroringMessageHandler, IgnoringMessageHandler, MessageHandler, PeerManager,
 };
@@ -167,7 +167,8 @@ async fn connect_peer<L: Deref + Clone + Send + Sync + 'static>(current_peer: (P
        // we seek to find out if the first connection attempt was successful
        let (sender, mut receiver) = mpsc::channel::<bool>(1);
        tokio::spawn(async move {
-               log_info!(logger, "Connecting to peer {}@{}...", current_peer.0.to_hex(), current_peer.1.to_string());
+               let current_peer_pubkey_hex = current_peer.0.serialize().to_lower_hex_string();
+               log_info!(logger, "Connecting to peer {}@{}...", current_peer_pubkey_hex, current_peer.1);
                let mut is_first_iteration = true;
                loop {
                        if let Some(disconnection_future) = lightning_net_tokio::connect_outbound(
@@ -175,21 +176,21 @@ async fn connect_peer<L: Deref + Clone + Send + Sync + 'static>(current_peer: (P
                                current_peer.0,
                                current_peer.1,
                        ).await {
-                               log_info!(logger, "Connected to peer {}@{}!", current_peer.0.to_hex(), current_peer.1.to_string());
+                               log_info!(logger, "Connected to peer {}@{}!", current_peer_pubkey_hex, current_peer.1);
                                if is_first_iteration {
                                        sender.send(true).await.unwrap();
                                }
                                disconnection_future.await;
-                               log_warn!(logger, "Disconnected from peer {}@{}", current_peer.0.to_hex(), current_peer.1.to_string());
+                               log_warn!(logger, "Disconnected from peer {}@{}", current_peer_pubkey_hex, current_peer.1);
                        } else {
-                               log_warn!(logger, "Failed to connect to peer {}@{}!", current_peer.0.to_hex(), current_peer.1.to_string());
+                               log_warn!(logger, "Failed to connect to peer {}@{}!", current_peer_pubkey_hex, current_peer.1);
                                if is_first_iteration {
                                        sender.send(false).await.unwrap();
                                }
                        }
                        is_first_iteration = false;
                        tokio::time::sleep(Duration::from_secs(10)).await;
-                       log_warn!(logger, "Reconnecting to peer {}@{}...", current_peer.0.to_hex(), current_peer.1.to_string());
+                       log_warn!(logger, "Reconnecting to peer {}@{}...", current_peer_pubkey_hex, current_peer.1);
                }
        });
 
index 93527a45b837c7368d9bc2842167323ff4c2e397..0c6c9b2533a7404c556e4e3a15bfa673bd178bc5 100644 (file)
@@ -29,7 +29,7 @@ impl RGSSLogger {
 }
 
 impl Logger for RGSSLogger {
-       fn log(&self, record: &Record) {
+       fn log(&self, record: Record) {
                let threshold = config::log_level();
                if record.level < threshold {
                        return;
@@ -84,7 +84,7 @@ pub mod tests {
        }
 
        impl Logger for TestLogger {
-               fn log(&self, record: &Record) {
+               fn log(&self, record: Record) {
                        *self.lines.lock().unwrap().entry((record.module_path.to_string(), format!("{}", record.args))).or_insert(0) += 1;
                        println!("{:<5} {} [{} : {}, {}] {}", record.level.to_string(), self.id, record.module_path, record.file, record.line, record.args);
                }