Skip to content

Commit 3cdd1c7

Browse files
committed
Drop lsps1_service cfg flag
1 parent be89fdb commit 3cdd1c7

File tree

12 files changed

+5
-51
lines changed

12 files changed

+5
-51
lines changed

ci/ci-tests.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,4 @@ RUSTFLAGS="--cfg=taproot" cargo test --verbose --color always -p lightning
144144
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
145145
RUSTFLAGS="--cfg=simple_close" cargo test --verbose --color always -p lightning
146146
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
147-
RUSTFLAGS="--cfg=lsps1_service" cargo test --verbose --color always -p lightning-liquidity
148-
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
149147
RUSTFLAGS="--cfg=peer_storage" cargo test --verbose --color always -p lightning

lightning-liquidity/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ parking_lot = { version = "0.12", default-features = false }
4747
level = "forbid"
4848
# When adding a new cfg attribute, ensure that it is added to this list.
4949
check-cfg = [
50-
"cfg(lsps1_service)",
5150
"cfg(c_bindings)",
5251
"cfg(backtrace)",
5352
"cfg(ldk_bench)",

lightning-liquidity/src/events/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ pub enum LiquidityEvent {
3333
/// An LSPS1 (Channel Request) client event.
3434
LSPS1Client(lsps1::event::LSPS1ClientEvent),
3535
/// An LSPS1 (Channel Request) server event.
36-
#[cfg(lsps1_service)]
3736
LSPS1Service(lsps1::event::LSPS1ServiceEvent),
3837
/// An LSPS2 (JIT Channel) client event.
3938
LSPS2Client(lsps2::event::LSPS2ClientEvent),
@@ -57,7 +56,6 @@ impl From<lsps1::event::LSPS1ClientEvent> for LiquidityEvent {
5756
}
5857
}
5958

60-
#[cfg(lsps1_service)]
6159
impl From<lsps1::event::LSPS1ServiceEvent> for LiquidityEvent {
6260
fn from(event: lsps1::event::LSPS1ServiceEvent) -> Self {
6361
Self::LSPS1Service(event)

lightning-liquidity/src/lsps1/event.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ pub enum LSPS1ClientEvent {
142142
}
143143

144144
/// An event which an LSPS1 server should take some action in response to.
145-
#[cfg(lsps1_service)]
146145
#[derive(Clone, Debug, PartialEq, Eq)]
147146
pub enum LSPS1ServiceEvent {
148147
/// A client has selected the parameters to use from the supported options of the LSP

lightning-liquidity/src/lsps1/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@
1212
pub mod client;
1313
pub mod event;
1414
pub mod msgs;
15-
#[cfg(lsps1_service)]
1615
pub(crate) mod peer_state;
17-
#[cfg(lsps1_service)]
1816
pub mod service;

lightning-liquidity/src/lsps1/msgs.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ pub(crate) const LSPS1_CREATE_ORDER_METHOD_NAME: &str = "lsps1.create_order";
3131
pub(crate) const LSPS1_GET_ORDER_METHOD_NAME: &str = "lsps1.get_order";
3232

3333
pub(crate) const _LSPS1_CREATE_ORDER_REQUEST_INVALID_PARAMS_ERROR_CODE: i32 = -32602;
34-
#[cfg(lsps1_service)]
3534
pub(crate) const LSPS1_CREATE_ORDER_REQUEST_ORDER_MISMATCH_ERROR_CODE: i32 = 100;
36-
#[cfg(lsps1_service)]
3735
pub(crate) const LSPS1_GET_ORDER_REQUEST_ORDER_NOT_FOUND_ERROR_CODE: i32 = 101;
3836
pub(crate) const LSPS1_CREATE_ORDER_REQUEST_UNRECOGNIZED_OR_STALE_TOKEN_ERROR_CODE: i32 = 102;
3937

lightning-liquidity/src/manager.rs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ use crate::lsps5::client::{LSPS5ClientConfig, LSPS5ClientHandler};
2323
use crate::lsps5::msgs::LSPS5Message;
2424
use crate::lsps5::service::{LSPS5ServiceConfig, LSPS5ServiceHandler};
2525
use crate::message_queue::MessageQueue;
26-
#[cfg(lsps1_service)]
27-
use crate::persist::read_lsps1_service_peer_states;
2826
use crate::persist::{
29-
read_event_queue, read_lsps2_service_peer_states, read_lsps5_service_peer_states,
27+
read_event_queue, read_lsps1_service_peer_states, read_lsps2_service_peer_states,
28+
read_lsps5_service_peer_states,
3029
};
3130

3231
use crate::lsps1::client::{LSPS1ClientConfig, LSPS1ClientHandler};
3332
use crate::lsps1::msgs::LSPS1Message;
34-
#[cfg(lsps1_service)]
3533
use crate::lsps1::service::{LSPS1ServiceConfig, LSPS1ServiceHandler, LSPS1ServiceHandlerSync};
3634

3735
use crate::lsps2::client::{LSPS2ClientConfig, LSPS2ClientHandler};
@@ -73,7 +71,6 @@ const LSPS_FEATURE_BIT: usize = 729;
7371
#[derive(Clone)]
7472
pub struct LiquidityServiceConfig {
7573
/// Optional server-side configuration for LSPS1 channel requests.
76-
#[cfg(lsps1_service)]
7774
pub lsps1_service_config: Option<LSPS1ServiceConfig>,
7875
/// Optional server-side configuration for JIT channels
7976
/// should you want to support them.
@@ -301,7 +298,6 @@ pub struct LiquidityManager<
301298
ignored_peers: RwLock<HashSet<PublicKey>>,
302299
lsps0_client_handler: LSPS0ClientHandler<ES, K>,
303300
lsps0_service_handler: Option<LSPS0ServiceHandler>,
304-
#[cfg(lsps1_service)]
305301
lsps1_service_handler: Option<LSPS1ServiceHandler<ES, CM, K, TP>>,
306302
lsps1_client_handler: Option<LSPS1ClientHandler<ES, K>>,
307303
lsps2_service_handler: Option<LSPS2ServiceHandler<CM, K, T>>,
@@ -476,7 +472,6 @@ where
476472
})
477473
});
478474

479-
#[cfg(lsps1_service)]
480475
let lsps1_service_handler = if let Some(service_config) = service_config.as_ref() {
481476
if let Some(lsps1_service_config) = service_config.lsps1_service_config.as_ref() {
482477
if let Some(number) =
@@ -524,7 +519,6 @@ where
524519
lsps0_client_handler,
525520
lsps0_service_handler,
526521
lsps1_client_handler,
527-
#[cfg(lsps1_service)]
528522
lsps1_service_handler,
529523
lsps2_client_handler,
530524
lsps2_service_handler,
@@ -555,7 +549,6 @@ where
555549
}
556550

557551
/// Returns a reference to the LSPS1 server-side handler.
558-
#[cfg(lsps1_service)]
559552
pub fn lsps1_service_handler(&self) -> Option<&LSPS1ServiceHandler<ES, CM, K, TP>> {
560553
self.lsps1_service_handler.as_ref()
561554
}
@@ -704,18 +697,15 @@ where
704697
},
705698
}
706699
},
707-
LSPSMessage::LSPS1(_msg @ LSPS1Message::Request(..)) => {
708-
#[cfg(lsps1_service)]
700+
LSPSMessage::LSPS1(msg @ LSPS1Message::Request(..)) => {
709701
match &self.lsps1_service_handler {
710702
Some(lsps1_service_handler) => {
711-
lsps1_service_handler.handle_message(_msg, sender_node_id)?;
703+
lsps1_service_handler.handle_message(msg, sender_node_id)?;
712704
},
713705
None => {
714706
return Err(LightningError { err: format!("Received LSPS1 request message without LSPS1 service handler configured. From node {}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
715707
},
716708
}
717-
#[cfg(not(lsps1_service))]
718-
return Err(LightningError { err: format!("Received LSPS1 request message without LSPS1 service handler configured. From node {}", sender_node_id), action: ErrorAction::IgnoreAndLog(Level::Debug)});
719709
},
720710
LSPSMessage::LSPS2(msg @ LSPS2Message::Response(..)) => {
721711
match &self.lsps2_client_handler {
@@ -756,14 +746,10 @@ where
756746
.lsps2_service_handler
757747
.as_ref()
758748
.is_some_and(|h| h.has_active_requests(sender_node_id));
759-
#[cfg(lsps1_service)]
760749
let lsps1_has_active_requests = self
761750
.lsps1_service_handler
762751
.as_ref()
763752
.is_some_and(|h| h.has_active_requests(sender_node_id));
764-
#[cfg(not(lsps1_service))]
765-
let lsps1_has_active_requests = false;
766-
767753
lsps5_service_handler.enforce_prior_activity_or_reject(
768754
sender_node_id,
769755
lsps2_has_active_requests,
@@ -927,7 +913,6 @@ where
927913
// If the peer was misbehaving, drop it from the ignored list to cleanup the kept state.
928914
self.ignored_peers.write().unwrap().remove(&counterparty_node_id);
929915

930-
#[cfg(lsps1_service)]
931916
if let Some(lsps1_service_handler) = self.lsps1_service_handler.as_ref() {
932917
lsps1_service_handler.peer_disconnected(counterparty_node_id);
933918
}
@@ -1092,7 +1077,6 @@ where
10921077
/// Returns a reference to the LSPS1 server-side handler.
10931078
///
10941079
/// Wraps [`LiquidityManager::lsps1_service_handler`].
1095-
#[cfg(lsps1_service)]
10961080
pub fn lsps1_service_handler<'a>(
10971081
&'a self,
10981082
) -> Option<LSPS1ServiceHandlerSync<'a, ES, CM, KVStoreSyncWrapper<KS>, TP>> {

lightning-liquidity/src/persist.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//! Types and utils for persistence.
1111
1212
use crate::events::{EventQueueDeserWrapper, LiquidityEvent};
13-
#[cfg(lsps1_service)]
1413
use crate::lsps1::peer_state::PeerState as LSPS1ServicePeerState;
1514
use crate::lsps2::service::PeerState as LSPS2ServicePeerState;
1615
use crate::lsps5::service::PeerState as LSPS5ServicePeerState;
@@ -92,7 +91,6 @@ where
9291
Ok(Some(queue.0))
9392
}
9493

95-
#[cfg(lsps1_service)]
9694
pub(crate) async fn read_lsps1_service_peer_states<K: Deref>(
9795
kv_store: K,
9896
) -> Result<HashMap<PublicKey, Mutex<LSPS1ServicePeerState>>, lightning::io::Error>

lightning-liquidity/tests/lsps0_integration_tests.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ use common::{create_service_and_client_nodes, get_lsps_message, LSPSNodes};
66

77
use lightning_liquidity::events::LiquidityEvent;
88
use lightning_liquidity::lsps0::event::LSPS0ClientEvent;
9-
#[cfg(lsps1_service)]
109
use lightning_liquidity::lsps1::client::LSPS1ClientConfig;
11-
#[cfg(lsps1_service)]
1210
use lightning_liquidity::lsps1::msgs::LSPS1Options;
13-
#[cfg(lsps1_service)]
1411
use lightning_liquidity::lsps1::service::LSPS1ServiceConfig;
1512
use lightning_liquidity::lsps2::client::LSPS2ClientConfig;
1613
use lightning_liquidity::lsps2::service::LSPS2ServiceConfig;
@@ -35,7 +32,6 @@ fn list_protocols_integration_test() {
3532
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
3633
let promise_secret = [42; 32];
3734
let lsps2_service_config = LSPS2ServiceConfig { promise_secret };
38-
#[cfg(lsps1_service)]
3935
let lsps1_service_config = {
4036
let supported_options = LSPS1Options {
4137
min_required_channel_confirmations: 0,
@@ -53,22 +49,17 @@ fn list_protocols_integration_test() {
5349
};
5450
let lsps5_service_config = LSPS5ServiceConfig::default();
5551
let service_config = LiquidityServiceConfig {
56-
#[cfg(lsps1_service)]
5752
lsps1_service_config: Some(lsps1_service_config),
5853
lsps2_service_config: Some(lsps2_service_config),
5954
lsps5_service_config: Some(lsps5_service_config),
6055
advertise_service: true,
6156
};
6257

6358
let lsps2_client_config = LSPS2ClientConfig::default();
64-
#[cfg(lsps1_service)]
6559
let lsps1_client_config: LSPS1ClientConfig = LSPS1ClientConfig { max_channel_fees_msat: None };
6660
let lsps5_client_config = LSPS5ClientConfig::default();
6761
let client_config = LiquidityClientConfig {
68-
#[cfg(lsps1_service)]
6962
lsps1_client_config: Some(lsps1_client_config),
70-
#[cfg(not(lsps1_service))]
71-
lsps1_client_config: None,
7263
lsps2_client_config: Some(lsps2_client_config),
7364
lsps5_client_config: Some(lsps5_client_config),
7465
};
@@ -107,16 +98,12 @@ fn list_protocols_integration_test() {
10798
protocols,
10899
}) => {
109100
assert_eq!(counterparty_node_id, client_node_id);
110-
#[cfg(lsps1_service)]
111101
{
112102
assert!(protocols.contains(&1));
113103
assert!(protocols.contains(&2));
114104
assert!(protocols.contains(&5));
115105
assert_eq!(protocols.len(), 3);
116106
}
117-
118-
#[cfg(not(lsps1_service))]
119-
assert_eq!(protocols, vec![2, 5]);
120107
},
121108
_ => panic!("Unexpected event"),
122109
}

lightning-liquidity/tests/lsps1_integration_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![cfg(all(test, feature = "time", lsps1_service))]
1+
#![cfg(all(test, feature = "time"))]
22

33
mod common;
44

0 commit comments

Comments
 (0)