Skip to content

Commit 5bd9afd

Browse files
committed
Use lightning::sync via symlink in lightning-liquidity
.. to which end we also need to make some additions to `debug_sync` and `nostd_sync`.
1 parent 2df2de8 commit 5bd9afd

File tree

10 files changed

+38
-124
lines changed

10 files changed

+38
-124
lines changed

lightning-liquidity/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ categories = ["cryptography::cryptocurrencies"]
1616
[features]
1717
default = ["std"]
1818
std = ["lightning/std"]
19+
backtrace = ["dep:backtrace"]
1920

2021
[dependencies]
2122
lightning = { version = "0.0.124", path = "../lightning", default-features = false }
@@ -27,6 +28,7 @@ bitcoin = { version = "0.32.2", default-features = false, features = ["serde"] }
2728
chrono = { version = "0.4", default-features = false, features = ["serde", "alloc"] }
2829
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
2930
serde_json = "1.0"
31+
backtrace = { version = "0.3", optional = true }
3032

3133
[dev-dependencies]
3234
lightning = { version = "0.0.124", path = "../lightning", default-features = false, features = ["_test_utils"] }
@@ -43,4 +45,6 @@ level = "forbid"
4345
check-cfg = [
4446
"cfg(lsps1_service)",
4547
"cfg(c_bindings)",
48+
"cfg(backtrace)",
49+
"cfg(ldk_bench)",
4650
]

lightning-liquidity/src/events.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(crate) struct EventQueue {
2828
queue: Arc<Mutex<VecDeque<Event>>>,
2929
waker: Arc<Mutex<Option<Waker>>>,
3030
#[cfg(feature = "std")]
31-
condvar: std::sync::Condvar,
31+
condvar: crate::sync::Condvar,
3232
}
3333

3434
impl EventQueue {
@@ -37,7 +37,7 @@ impl EventQueue {
3737
let waker = Arc::new(Mutex::new(None));
3838
#[cfg(feature = "std")]
3939
{
40-
let condvar = std::sync::Condvar::new();
40+
let condvar = crate::sync::Condvar::new();
4141
Self { queue, waker, condvar }
4242
}
4343
#[cfg(not(feature = "std"))]
@@ -67,8 +67,10 @@ impl EventQueue {
6767

6868
#[cfg(feature = "std")]
6969
pub fn wait_next_event(&self) -> Event {
70-
let mut queue =
71-
self.condvar.wait_while(self.queue.lock().unwrap(), |queue| queue.is_empty()).unwrap();
70+
let mut queue = self
71+
.condvar
72+
.wait_while(self.queue.lock().unwrap(), |queue: &mut VecDeque<Event>| queue.is_empty())
73+
.unwrap();
7274

7375
let event = queue.pop_front().expect("non-empty queue");
7476
let should_notify = !queue.is_empty();

lightning-liquidity/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ pub mod lsps1;
6161
pub mod lsps2;
6262
mod manager;
6363
pub mod message_queue;
64+
#[allow(dead_code)]
65+
#[allow(unused_imports)]
6466
mod sync;
6567
#[cfg(test)]
6668
mod tests;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../lightning/src/sync/debug_sync.rs
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../lightning/src/sync/fairrwlock.rs

lightning-liquidity/src/sync/mod.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

lightning-liquidity/src/sync/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../lightning/src/sync/mod.rs

lightning-liquidity/src/sync/nostd_sync.rs

Lines changed: 0 additions & 111 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../lightning/src/sync/nostd_sync.rs
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../lightning/src/sync/test_lockorder_checks.rs

0 commit comments

Comments
 (0)