diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22e0510..148e5c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,6 +30,7 @@ jobs: run: | cargo update -p proptest --precise "1.2.0" --verbose # proptest 1.3.0 requires rustc 1.64.0 cargo update -p regex --precise "1.9.6" --verbose # regex 1.10.0 requires rustc 1.65.0. + cargo update -p tokio --precise "1.38.1" --verbose # tokio v1.39.0 requires rustc 1.70 or newer - name: Cargo check run: cargo check --release - name: Check documentation diff --git a/Cargo.toml b/Cargo.toml index b172c03..832247c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,22 +16,29 @@ categories = ["cryptography::cryptocurrencies"] [features] default = ["std"] std = ["lightning/std", "bitcoin/std", "lightning-invoice/std"] -no-std = ["hashbrown", "lightning/no-std", "lightning-invoice/no-std", "bitcoin/no-std", "core2/alloc"] +no-std = ["hashbrown", "lightning/no-std"] [dependencies] -lightning = { version = "0.0.123", default-features = false } -lightning-invoice = { version = "0.31.0", default-features = false, features = ["serde"] } -bitcoin = { version = "0.30.2", default-features = false, features = ["serde"] } +lightning = { version = "0.0.124", default-features = false } +lightning-types = { version = "0.1", default-features = false } +lightning-invoice = { version = "0.32.0", default-features = false, features = ["serde"] } +bitcoin = { version = "0.32.2", default-features = false, features = ["serde"] } hashbrown = { version = "0.8", optional = true } -core2 = { version = "0.3.0", optional = true, default-features = false } chrono = { version = "0.4", default-features = false, features = ["serde", "alloc"] } serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] } serde_json = "1.0" [dev-dependencies] -lightning = { version = "0.0.123", default-features = false, features = ["_test_utils"] } -lightning-persister = { version = "0.0.123", default-features = false } -lightning-background-processor = { version = "0.0.123", default-features = false, features = ["std"] } +lightning = { version = "0.0.124", default-features = false, features = ["_test_utils"] } +lightning-persister = { version = "0.0.124", default-features = false } +lightning-background-processor = { version = "0.0.124", default-features = false, features = ["std"] } proptest = "1.0.0" tokio = { version = "1.35", default-features = false, features = [ "rt-multi-thread", "time", "sync", "macros" ] } + +[lints.rust.unexpected_cfgs] +level = "forbid" +# When adding a new cfg attribute, ensure that it is added to this list. +check-cfg = [ + "cfg(lsps1)", +] diff --git a/src/lsps2/service.rs b/src/lsps2/service.rs index 34025c8..7683631 100644 --- a/src/lsps2/service.rs +++ b/src/lsps2/service.rs @@ -21,10 +21,12 @@ use crate::sync::{Arc, Mutex, RwLock}; use lightning::events::HTLCDestination; use lightning::ln::channelmanager::{AChannelManager, InterceptId}; use lightning::ln::msgs::{ErrorAction, LightningError}; -use lightning::ln::{ChannelId, PaymentHash}; +use lightning::ln::types::ChannelId; use lightning::util::errors::APIError; use lightning::util::logger::Level; +use lightning_types::payment::PaymentHash; + use bitcoin::secp256k1::PublicKey; use core::ops::Deref; diff --git a/src/manager.rs b/src/manager.rs index 74690d8..1474740 100644 --- a/src/manager.rs +++ b/src/manager.rs @@ -569,6 +569,13 @@ where features } + + fn peer_disconnected(&self, _: &bitcoin::secp256k1::PublicKey) {} + fn peer_connected( + &self, _: &bitcoin::secp256k1::PublicKey, _: &lightning::ln::msgs::Init, _: bool, + ) -> Result<(), ()> { + Ok(()) + } } impl Listen for LiquidityManager diff --git a/tests/common/mod.rs b/tests/common/mod.rs index d3d35ac..3ab25e9 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -9,7 +9,7 @@ use lightning::sign::EntropySource; use bitcoin::blockdata::constants::{genesis_block, ChainHash}; use bitcoin::blockdata::transaction::Transaction; -use bitcoin::network::constants::Network; +use bitcoin::Network; use lightning::chain::channelmonitor::ANTI_REORG_DELAY; use lightning::chain::{chainmonitor, BestBlock, Confirm}; use lightning::ln::channelmanager; @@ -35,7 +35,7 @@ use lightning::util::test_utils; use lightning_liquidity::{LiquidityClientConfig, LiquidityManager, LiquidityServiceConfig}; use lightning_persister::fs_store::FilesystemStore; -use std::collections::VecDeque; +use std::collections::{HashMap, VecDeque}; use std::path::PathBuf; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::mpsc::SyncSender; @@ -143,10 +143,10 @@ impl Drop for Node { } struct Persister { - graph_error: Option<(std::io::ErrorKind, &'static str)>, + graph_error: Option<(lightning::io::ErrorKind, &'static str)>, graph_persistence_notifier: Option>, - manager_error: Option<(std::io::ErrorKind, &'static str)>, - scorer_error: Option<(std::io::ErrorKind, &'static str)>, + manager_error: Option<(lightning::io::ErrorKind, &'static str)>, + scorer_error: Option<(lightning::io::ErrorKind, &'static str)>, kv_store: FilesystemStore, } @@ -162,7 +162,7 @@ impl Persister { } } - fn with_graph_error(self, error: std::io::ErrorKind, message: &'static str) -> Self { + fn with_graph_error(self, error: lightning::io::ErrorKind, message: &'static str) -> Self { Self { graph_error: Some((error, message)), ..self } } @@ -170,11 +170,11 @@ impl Persister { Self { graph_persistence_notifier: Some(sender), ..self } } - fn with_manager_error(self, error: std::io::ErrorKind, message: &'static str) -> Self { + fn with_manager_error(self, error: lightning::io::ErrorKind, message: &'static str) -> Self { Self { manager_error: Some((error, message)), ..self } } - fn with_scorer_error(self, error: std::io::ErrorKind, message: &'static str) -> Self { + fn with_scorer_error(self, error: lightning::io::ErrorKind, message: &'static str) -> Self { Self { scorer_error: Some((error, message)), ..self } } } @@ -194,7 +194,7 @@ impl KVStore for Persister { && key == CHANNEL_MANAGER_PERSISTENCE_KEY { if let Some((error, message)) = self.manager_error { - return Err(std::io::Error::new(error, message)); + return Err(lightning::io::Error::new(error, message)); } } @@ -212,7 +212,7 @@ impl KVStore for Persister { }; if let Some((error, message)) = self.graph_error { - return Err(std::io::Error::new(error, message)); + return Err(lightning::io::Error::new(error, message)); } } @@ -221,7 +221,7 @@ impl KVStore for Persister { && key == SCORER_PERSISTENCE_KEY { if let Some((error, message)) = self.scorer_error { - return Err(std::io::Error::new(error, message)); + return Err(lightning::io::Error::new(error, message)); } } @@ -362,9 +362,6 @@ impl ScoreUpdate for TestScorer { fn time_passed(&mut self, _: Duration) {} } -#[cfg(c_bindings)] -impl lightning::routing::scoring::Score for TestScorer {} - impl Drop for TestScorer { fn drop(&mut self) { if std::thread::panicking() { @@ -390,7 +387,9 @@ pub(crate) fn create_liquidity_node( client_config: Option, ) -> Node { let tx_broadcaster = Arc::new(test_utils::TestBroadcaster::new(network)); - let fee_estimator = Arc::new(test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) }); + let target_override = Mutex::new(HashMap::new()); + let fee_estimator = + Arc::new(test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253), target_override }); let logger = Arc::new(test_utils::TestLogger::with_id(format!("node {}", i))); let genesis_block = genesis_block(network); let network_graph = Arc::new(NetworkGraph::new(network, logger.clone()));