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

Commit 75b7a19

Browse files
authored
Merge pull request #143 from tnull/2024-08-upgrade-LDK-0.0.124
Upgrade to LDK 0.0.124, `rust-bitcoin` 0.32.2
2 parents 8dd8a1c + 3dd4e52 commit 75b7a19

File tree

5 files changed

+40
-24
lines changed

5 files changed

+40
-24
lines changed

.github/workflows/build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
run: |
3131
cargo update -p proptest --precise "1.2.0" --verbose # proptest 1.3.0 requires rustc 1.64.0
3232
cargo update -p regex --precise "1.9.6" --verbose # regex 1.10.0 requires rustc 1.65.0.
33+
cargo update -p tokio --precise "1.38.1" --verbose # tokio v1.39.0 requires rustc 1.70 or newer
3334
- name: Cargo check
3435
run: cargo check --release
3536
- name: Check documentation

Cargo.toml

+15-8
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,29 @@ categories = ["cryptography::cryptocurrencies"]
1616
[features]
1717
default = ["std"]
1818
std = ["lightning/std", "bitcoin/std", "lightning-invoice/std"]
19-
no-std = ["hashbrown", "lightning/no-std", "lightning-invoice/no-std", "bitcoin/no-std", "core2/alloc"]
19+
no-std = ["hashbrown", "lightning/no-std"]
2020

2121
[dependencies]
22-
lightning = { version = "0.0.123", default-features = false }
23-
lightning-invoice = { version = "0.31.0", default-features = false, features = ["serde"] }
24-
bitcoin = { version = "0.30.2", default-features = false, features = ["serde"] }
22+
lightning = { version = "0.0.124", default-features = false }
23+
lightning-types = { version = "0.1", default-features = false }
24+
lightning-invoice = { version = "0.32.0", default-features = false, features = ["serde"] }
25+
bitcoin = { version = "0.32.2", default-features = false, features = ["serde"] }
2526
hashbrown = { version = "0.8", optional = true }
26-
core2 = { version = "0.3.0", optional = true, default-features = false }
2727

2828
chrono = { version = "0.4", default-features = false, features = ["serde", "alloc"] }
2929
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
3030
serde_json = "1.0"
3131

3232
[dev-dependencies]
33-
lightning = { version = "0.0.123", default-features = false, features = ["_test_utils"] }
34-
lightning-persister = { version = "0.0.123", default-features = false }
35-
lightning-background-processor = { version = "0.0.123", default-features = false, features = ["std"] }
33+
lightning = { version = "0.0.124", default-features = false, features = ["_test_utils"] }
34+
lightning-persister = { version = "0.0.124", default-features = false }
35+
lightning-background-processor = { version = "0.0.124", default-features = false, features = ["std"] }
3636
proptest = "1.0.0"
3737
tokio = { version = "1.35", default-features = false, features = [ "rt-multi-thread", "time", "sync", "macros" ] }
38+
39+
[lints.rust.unexpected_cfgs]
40+
level = "forbid"
41+
# When adding a new cfg attribute, ensure that it is added to this list.
42+
check-cfg = [
43+
"cfg(lsps1)",
44+
]

src/lsps2/service.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ use crate::sync::{Arc, Mutex, RwLock};
2121
use lightning::events::HTLCDestination;
2222
use lightning::ln::channelmanager::{AChannelManager, InterceptId};
2323
use lightning::ln::msgs::{ErrorAction, LightningError};
24-
use lightning::ln::{ChannelId, PaymentHash};
24+
use lightning::ln::types::ChannelId;
2525
use lightning::util::errors::APIError;
2626
use lightning::util::logger::Level;
2727

28+
use lightning_types::payment::PaymentHash;
29+
2830
use bitcoin::secp256k1::PublicKey;
2931

3032
use core::ops::Deref;

src/manager.rs

+7
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,13 @@ where
569569

570570
features
571571
}
572+
573+
fn peer_disconnected(&self, _: &bitcoin::secp256k1::PublicKey) {}
574+
fn peer_connected(
575+
&self, _: &bitcoin::secp256k1::PublicKey, _: &lightning::ln::msgs::Init, _: bool,
576+
) -> Result<(), ()> {
577+
Ok(())
578+
}
572579
}
573580

574581
impl<ES: Deref + Clone, CM: Deref + Clone, C: Deref + Clone> Listen for LiquidityManager<ES, CM, C>

tests/common/mod.rs

+14-15
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use lightning::sign::EntropySource;
99

1010
use bitcoin::blockdata::constants::{genesis_block, ChainHash};
1111
use bitcoin::blockdata::transaction::Transaction;
12-
use bitcoin::network::constants::Network;
12+
use bitcoin::Network;
1313
use lightning::chain::channelmonitor::ANTI_REORG_DELAY;
1414
use lightning::chain::{chainmonitor, BestBlock, Confirm};
1515
use lightning::ln::channelmanager;
@@ -35,7 +35,7 @@ use lightning::util::test_utils;
3535
use lightning_liquidity::{LiquidityClientConfig, LiquidityManager, LiquidityServiceConfig};
3636
use lightning_persister::fs_store::FilesystemStore;
3737

38-
use std::collections::VecDeque;
38+
use std::collections::{HashMap, VecDeque};
3939
use std::path::PathBuf;
4040
use std::sync::atomic::{AtomicBool, Ordering};
4141
use std::sync::mpsc::SyncSender;
@@ -143,10 +143,10 @@ impl Drop for Node {
143143
}
144144

145145
struct Persister {
146-
graph_error: Option<(std::io::ErrorKind, &'static str)>,
146+
graph_error: Option<(lightning::io::ErrorKind, &'static str)>,
147147
graph_persistence_notifier: Option<SyncSender<()>>,
148-
manager_error: Option<(std::io::ErrorKind, &'static str)>,
149-
scorer_error: Option<(std::io::ErrorKind, &'static str)>,
148+
manager_error: Option<(lightning::io::ErrorKind, &'static str)>,
149+
scorer_error: Option<(lightning::io::ErrorKind, &'static str)>,
150150
kv_store: FilesystemStore,
151151
}
152152

@@ -162,19 +162,19 @@ impl Persister {
162162
}
163163
}
164164

165-
fn with_graph_error(self, error: std::io::ErrorKind, message: &'static str) -> Self {
165+
fn with_graph_error(self, error: lightning::io::ErrorKind, message: &'static str) -> Self {
166166
Self { graph_error: Some((error, message)), ..self }
167167
}
168168

169169
fn with_graph_persistence_notifier(self, sender: SyncSender<()>) -> Self {
170170
Self { graph_persistence_notifier: Some(sender), ..self }
171171
}
172172

173-
fn with_manager_error(self, error: std::io::ErrorKind, message: &'static str) -> Self {
173+
fn with_manager_error(self, error: lightning::io::ErrorKind, message: &'static str) -> Self {
174174
Self { manager_error: Some((error, message)), ..self }
175175
}
176176

177-
fn with_scorer_error(self, error: std::io::ErrorKind, message: &'static str) -> Self {
177+
fn with_scorer_error(self, error: lightning::io::ErrorKind, message: &'static str) -> Self {
178178
Self { scorer_error: Some((error, message)), ..self }
179179
}
180180
}
@@ -194,7 +194,7 @@ impl KVStore for Persister {
194194
&& key == CHANNEL_MANAGER_PERSISTENCE_KEY
195195
{
196196
if let Some((error, message)) = self.manager_error {
197-
return Err(std::io::Error::new(error, message));
197+
return Err(lightning::io::Error::new(error, message));
198198
}
199199
}
200200

@@ -212,7 +212,7 @@ impl KVStore for Persister {
212212
};
213213

214214
if let Some((error, message)) = self.graph_error {
215-
return Err(std::io::Error::new(error, message));
215+
return Err(lightning::io::Error::new(error, message));
216216
}
217217
}
218218

@@ -221,7 +221,7 @@ impl KVStore for Persister {
221221
&& key == SCORER_PERSISTENCE_KEY
222222
{
223223
if let Some((error, message)) = self.scorer_error {
224-
return Err(std::io::Error::new(error, message));
224+
return Err(lightning::io::Error::new(error, message));
225225
}
226226
}
227227

@@ -362,9 +362,6 @@ impl ScoreUpdate for TestScorer {
362362
fn time_passed(&mut self, _: Duration) {}
363363
}
364364

365-
#[cfg(c_bindings)]
366-
impl lightning::routing::scoring::Score for TestScorer {}
367-
368365
impl Drop for TestScorer {
369366
fn drop(&mut self) {
370367
if std::thread::panicking() {
@@ -390,7 +387,9 @@ pub(crate) fn create_liquidity_node(
390387
client_config: Option<LiquidityClientConfig>,
391388
) -> Node {
392389
let tx_broadcaster = Arc::new(test_utils::TestBroadcaster::new(network));
393-
let fee_estimator = Arc::new(test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) });
390+
let target_override = Mutex::new(HashMap::new());
391+
let fee_estimator =
392+
Arc::new(test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253), target_override });
394393
let logger = Arc::new(test_utils::TestLogger::with_id(format!("node {}", i)));
395394
let genesis_block = genesis_block(network);
396395
let network_graph = Arc::new(NetworkGraph::new(network, logger.clone()));

0 commit comments

Comments
 (0)