Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
Merge pull request #143 from tnull/2024-08-upgrade-LDK-0.0.124
Browse files Browse the repository at this point in the history
Upgrade to LDK 0.0.124, `rust-bitcoin` 0.32.2
  • Loading branch information
tnull authored Sep 9, 2024
2 parents 8dd8a1c + 3dd4e52 commit 75b7a19
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 15 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
]
4 changes: 3 additions & 1 deletion src/lsps2/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ES: Deref + Clone, CM: Deref + Clone, C: Deref + Clone> Listen for LiquidityManager<ES, CM, C>
Expand Down
29 changes: 14 additions & 15 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<SyncSender<()>>,
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,
}

Expand All @@ -162,19 +162,19 @@ 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 }
}

fn with_graph_persistence_notifier(self, sender: SyncSender<()>) -> Self {
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 }
}
}
Expand All @@ -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));
}
}

Expand All @@ -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));
}
}

Expand All @@ -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));
}
}

Expand Down Expand Up @@ -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() {
Expand All @@ -390,7 +387,9 @@ pub(crate) fn create_liquidity_node(
client_config: Option<LiquidityClientConfig>,
) -> 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()));
Expand Down

0 comments on commit 75b7a19

Please sign in to comment.