diff --git a/lightning-liquidity/src/events.rs b/lightning-liquidity/src/events.rs index 3db772deec8..d10d5e855d2 100644 --- a/lightning-liquidity/src/events.rs +++ b/lightning-liquidity/src/events.rs @@ -28,7 +28,7 @@ use core::task::{Poll, Waker}; pub const MAX_EVENT_QUEUE_SIZE: usize = 1000; pub(crate) struct EventQueue { - queue: Arc>>, + queue: Arc>>, waker: Arc>>, #[cfg(feature = "std")] condvar: crate::sync::Condvar, @@ -47,7 +47,7 @@ impl EventQueue { Self { queue, waker } } - pub fn enqueue(&self, event: Event) { + pub fn enqueue(&self, event: LSPSEvent) { { let mut queue = self.queue.lock().unwrap(); if queue.len() < MAX_EVENT_QUEUE_SIZE { @@ -64,19 +64,19 @@ impl EventQueue { self.condvar.notify_one(); } - pub fn next_event(&self) -> Option { + pub fn next_event(&self) -> Option { self.queue.lock().unwrap().pop_front() } - pub async fn next_event_async(&self) -> Event { + pub async fn next_event_async(&self) -> LSPSEvent { EventFuture { event_queue: Arc::clone(&self.queue), waker: Arc::clone(&self.waker) }.await } #[cfg(feature = "std")] - pub fn wait_next_event(&self) -> Event { + pub fn wait_next_event(&self) -> LSPSEvent { let mut queue = self .condvar - .wait_while(self.queue.lock().unwrap(), |queue: &mut VecDeque| queue.is_empty()) + .wait_while(self.queue.lock().unwrap(), |queue: &mut VecDeque| queue.is_empty()) .unwrap(); let event = queue.pop_front().expect("non-empty queue"); @@ -95,14 +95,14 @@ impl EventQueue { event } - pub fn get_and_clear_pending_events(&self) -> Vec { + pub fn get_and_clear_pending_events(&self) -> Vec { self.queue.lock().unwrap().split_off(0).into() } } /// An event which you should probably take some action in response to. #[derive(Debug, Clone, PartialEq, Eq)] -pub enum Event { +pub enum LSPSEvent { /// An LSPS0 client event. LSPS0Client(lsps0::event::LSPS0ClientEvent), /// An LSPS1 (Channel Request) client event. @@ -117,12 +117,12 @@ pub enum Event { } struct EventFuture { - event_queue: Arc>>, + event_queue: Arc>>, waker: Arc>>, } impl Future for EventFuture { - type Output = Event; + type Output = LSPSEvent; fn poll( self: core::pin::Pin<&mut Self>, cx: &mut core::task::Context<'_>, @@ -154,7 +154,7 @@ mod tests { let secp_ctx = Secp256k1::new(); let counterparty_node_id = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap()); - let expected_event = Event::LSPS0Client(LSPS0ClientEvent::ListProtocolsResponse { + let expected_event = LSPSEvent::LSPS0Client(LSPS0ClientEvent::ListProtocolsResponse { counterparty_node_id, protocols: Vec::new(), }); diff --git a/lightning-liquidity/src/lsps0/client.rs b/lightning-liquidity/src/lsps0/client.rs index ab169bd7efb..c017b13ebde 100644 --- a/lightning-liquidity/src/lsps0/client.rs +++ b/lightning-liquidity/src/lsps0/client.rs @@ -4,7 +4,7 @@ //! specifcation](https://github.com/BitcoinAndLightningLayerSpecs/lsp/tree/main/LSPS0) for more //! information. -use crate::events::{Event, EventQueue}; +use crate::events::{LSPSEvent, EventQueue}; use crate::lsps0::event::LSPS0ClientEvent; use crate::lsps0::msgs::{ LSPS0Message, LSPS0Request, LSPS0Response, ListProtocolsRequest, ListProtocolsResponse, @@ -62,7 +62,7 @@ where ) -> Result<(), LightningError> { match response { LSPS0Response::ListProtocols(ListProtocolsResponse { protocols }) => { - self.pending_events.enqueue(Event::LSPS0Client( + self.pending_events.enqueue(LSPSEvent::LSPS0Client( LSPS0ClientEvent::ListProtocolsResponse { counterparty_node_id: *counterparty_node_id, protocols, diff --git a/lightning-liquidity/src/lsps0/msgs.rs b/lightning-liquidity/src/lsps0/msgs.rs index 631cc9206c5..817b4b60650 100644 --- a/lightning-liquidity/src/lsps0/msgs.rs +++ b/lightning-liquidity/src/lsps0/msgs.rs @@ -38,7 +38,7 @@ pub enum LSPS0Request { impl LSPS0Request { /// Returns the method name associated with the given request variant. - pub fn method(&self) -> &str { + pub fn method(&self) -> &'static str { match self { LSPS0Request::ListProtocols(_) => LSPS0_LISTPROTOCOLS_METHOD_NAME, } diff --git a/lightning-liquidity/src/lsps1/client.rs b/lightning-liquidity/src/lsps1/client.rs index 75709d512a3..51803957f3e 100644 --- a/lightning-liquidity/src/lsps1/client.rs +++ b/lightning-liquidity/src/lsps1/client.rs @@ -11,12 +11,12 @@ use super::event::LSPS1ClientEvent; use super::msgs::{ - CreateOrderRequest, CreateOrderResponse, GetInfoRequest, GetInfoResponse, GetOrderRequest, + CreateOrderRequest, CreateOrderResponse, LSPS1GetInfoRequest, LSPS1GetInfoResponse, GetOrderRequest, LSPS1Message, LSPS1Request, LSPS1Response, OrderId, OrderParameters, }; use crate::message_queue::MessageQueue; -use crate::events::{Event, EventQueue}; +use crate::events::{LSPSEvent, EventQueue}; use crate::lsps0::ser::{ProtocolMessageHandler, RequestId, ResponseError}; use crate::prelude::{new_hash_map, HashMap, HashSet}; use crate::sync::{Arc, Mutex, RwLock}; @@ -94,14 +94,14 @@ where peer_state_lock.pending_get_info_requests.insert(request_id.clone()); } - let request = LSPS1Request::GetInfo(GetInfoRequest {}); + let request = LSPS1Request::GetInfo(LSPS1GetInfoRequest {}); let msg = LSPS1Message::Request(request_id.clone(), request).into(); self.pending_messages.enqueue(&counterparty_node_id, msg); request_id } fn handle_get_info_response( - &self, request_id: RequestId, counterparty_node_id: &PublicKey, result: GetInfoResponse, + &self, request_id: RequestId, counterparty_node_id: &PublicKey, result: LSPS1GetInfoResponse, ) -> Result<(), LightningError> { let outer_state_lock = self.per_peer_state.write().unwrap(); @@ -119,7 +119,7 @@ where }); } - self.pending_events.enqueue(Event::LSPS1Client( + self.pending_events.enqueue(LSPSEvent::LSPS1Client( LSPS1ClientEvent::SupportedOptionsReady { counterparty_node_id: *counterparty_node_id, supported_options: result.options, @@ -156,7 +156,7 @@ where }); } - self.pending_events.enqueue(Event::LSPS1Client( + self.pending_events.enqueue(LSPSEvent::LSPS1Client( LSPS1ClientEvent::SupportedOptionsRequestFailed { request_id: request_id.clone(), counterparty_node_id: *counterparty_node_id, @@ -233,7 +233,7 @@ where }); } - self.pending_events.enqueue(Event::LSPS1Client(LSPS1ClientEvent::OrderCreated { + self.pending_events.enqueue(LSPSEvent::LSPS1Client(LSPS1ClientEvent::OrderCreated { request_id, counterparty_node_id: *counterparty_node_id, order_id: response.order_id, @@ -274,7 +274,7 @@ where }); } - self.pending_events.enqueue(Event::LSPS1Client( + self.pending_events.enqueue(LSPSEvent::LSPS1Client( LSPS1ClientEvent::OrderRequestFailed { request_id: request_id.clone(), counterparty_node_id: *counterparty_node_id, @@ -352,7 +352,7 @@ where }); } - self.pending_events.enqueue(Event::LSPS1Client(LSPS1ClientEvent::OrderStatus { + self.pending_events.enqueue(LSPSEvent::LSPS1Client(LSPS1ClientEvent::OrderStatus { request_id, counterparty_node_id: *counterparty_node_id, order_id: response.order_id, @@ -393,7 +393,7 @@ where }); } - self.pending_events.enqueue(Event::LSPS1Client( + self.pending_events.enqueue(LSPSEvent::LSPS1Client( LSPS1ClientEvent::OrderRequestFailed { request_id: request_id.clone(), counterparty_node_id: *counterparty_node_id, diff --git a/lightning-liquidity/src/lsps1/event.rs b/lightning-liquidity/src/lsps1/event.rs index ff4961d49b8..32d915e03db 100644 --- a/lightning-liquidity/src/lsps1/event.rs +++ b/lightning-liquidity/src/lsps1/event.rs @@ -10,7 +10,7 @@ //! Contains LSPS1 event types use super::msgs::OrderId; -use super::msgs::{ChannelInfo, LSPS1Options, OrderParameters, PaymentInfo}; +use super::msgs::{LSPS1ChannelInfo, LSPS1Options, OrderParameters, PaymentInfo}; use crate::lsps0::ser::{RequestId, ResponseError}; @@ -84,7 +84,7 @@ pub enum LSPS1ClientEvent { /// The details regarding payment of the order payment: PaymentInfo, /// The details regarding state of the channel ordered. - channel: Option, + channel: Option, }, /// Information from the LSP about the status of a previously created order. /// @@ -108,7 +108,7 @@ pub enum LSPS1ClientEvent { /// The details regarding payment of the order payment: PaymentInfo, /// The details regarding state of the channel ordered. - channel: Option, + channel: Option, }, /// A request previously issued via [`LSPS1ClientHandler::create_order`] or [`LSPS1ClientHandler::check_order_status`]. /// failed as the LSP returned an error response. diff --git a/lightning-liquidity/src/lsps1/msgs.rs b/lightning-liquidity/src/lsps1/msgs.rs index 42f10c04772..5c0cc503521 100644 --- a/lightning-liquidity/src/lsps1/msgs.rs +++ b/lightning-liquidity/src/lsps1/msgs.rs @@ -35,7 +35,7 @@ pub struct OrderId(pub String); /// for more information. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, Default)] #[serde(default)] -pub struct GetInfoRequest {} +pub struct LSPS1GetInfoRequest {} /// An object representing the supported protocol options. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] @@ -68,9 +68,9 @@ pub struct LSPS1Options { pub max_channel_balance_sat: u64, } -/// A response to a [`GetInfoRequest`]. +/// A response to a [`LSPS1GetInfoRequest`]. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct GetInfoResponse { +pub struct LSPS1GetInfoResponse { /// All options supported by the LSP. #[serde(flatten)] pub options: LSPS1Options, @@ -131,7 +131,7 @@ pub struct CreateOrderResponse { /// Contains details about how to pay for the order. pub payment: PaymentInfo, /// Contains information about the channel state. - pub channel: Option, + pub channel: Option, } /// An object representing the state of an order. @@ -233,7 +233,7 @@ pub struct OnchainPayment { /// Details regarding the state of an ordered channel. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct ChannelInfo { +pub struct LSPS1ChannelInfo { /// The datetime when the funding transaction has been published. pub funded_at: chrono::DateTime, /// The outpoint of the funding transaction. @@ -256,7 +256,7 @@ pub struct GetOrderRequest { #[derive(Clone, Debug, PartialEq, Eq)] pub enum LSPS1Request { /// A request to learn about the options supported by the LSP. - GetInfo(GetInfoRequest), + GetInfo(LSPS1GetInfoRequest), /// A request to create a channel order. CreateOrder(CreateOrderRequest), /// A request to query a previously created channel order. @@ -266,9 +266,9 @@ pub enum LSPS1Request { /// An enum that captures all the valid JSON-RPC responses in the LSPS1 protocol. #[derive(Clone, Debug, PartialEq, Eq)] pub enum LSPS1Response { - /// A successful response to a [`GetInfoRequest`]. - GetInfo(GetInfoResponse), - /// An error response to a [`GetInfoRequest`]. + /// A successful response to a [`LSPS1GetInfoRequest`]. + GetInfo(LSPS1GetInfoResponse), + /// An error response to a [`LSPS1GetInfoRequest`]. GetInfoError(ResponseError), /// A successful response to a [`CreateOrderRequest`]. CreateOrder(CreateOrderResponse), @@ -460,7 +460,7 @@ mod tests { "funding_outpoint": "0301e0480b374b32851a9462db29dc19fe830a7f7d7a88b81612b9d42099c0ae:0", "expires_at": "2012-04-23T18:25:43.511Z" }"#; - let _channel: ChannelInfo = serde_json::from_str(json_str).unwrap(); + let _channel: LSPS1ChannelInfo = serde_json::from_str(json_str).unwrap(); let json_str = r#""CANCELLED""#; let payment_state: PaymentState = serde_json::from_str(json_str).unwrap(); diff --git a/lightning-liquidity/src/lsps1/service.rs b/lightning-liquidity/src/lsps1/service.rs index 6520adcf69b..c60ae25e6f7 100644 --- a/lightning-liquidity/src/lsps1/service.rs +++ b/lightning-liquidity/src/lsps1/service.rs @@ -11,7 +11,7 @@ use super::event::LSPS1ServiceEvent; use super::msgs::{ - ChannelInfo, CreateOrderRequest, CreateOrderResponse, GetInfoResponse, GetOrderRequest, + LSPS1ChannelInfo, CreateOrderRequest, CreateOrderResponse, GetInfoResponse, GetOrderRequest, LSPS1Message, LSPS1Options, LSPS1Request, LSPS1Response, OrderId, OrderParameters, OrderState, PaymentInfo, LSPS1_CREATE_ORDER_REQUEST_ORDER_MISMATCH_ERROR_CODE, }; @@ -364,7 +364,7 @@ where /// [`LSPS1ServiceEvent::CheckPaymentConfirmation`]: crate::lsps1::event::LSPS1ServiceEvent::CheckPaymentConfirmation pub fn update_order_status( &self, request_id: RequestId, counterparty_node_id: PublicKey, order_id: OrderId, - order_state: OrderState, channel: Option, + order_state: OrderState, channel: Option, ) -> Result<(), APIError> { let (result, response) = { let outer_state_lock = self.per_peer_state.read().unwrap(); diff --git a/lightning-liquidity/src/lsps2/client.rs b/lightning-liquidity/src/lsps2/client.rs index 10707bc8c5a..32e27617360 100644 --- a/lightning-liquidity/src/lsps2/client.rs +++ b/lightning-liquidity/src/lsps2/client.rs @@ -8,7 +8,7 @@ //! Contains the main LSPS2 client object, [`LSPS2ClientHandler`]. -use crate::events::{Event, EventQueue}; +use crate::events::{LSPSEvent, EventQueue}; use crate::lsps0::ser::{ProtocolMessageHandler, RequestId, ResponseError}; use crate::lsps2::event::LSPS2ClientEvent; use crate::message_queue::MessageQueue; @@ -26,7 +26,7 @@ use core::default::Default; use core::ops::Deref; use crate::lsps2::msgs::{ - BuyRequest, BuyResponse, GetInfoRequest, GetInfoResponse, LSPS2Message, LSPS2Request, + BuyRequest, BuyResponse, LSPS2GetInfoRequest, LSPS2GetInfoResponse, LSPS2Message, LSPS2Request, LSPS2Response, OpeningFeeParams, }; @@ -122,7 +122,7 @@ where peer_state_lock.pending_get_info_requests.insert(request_id.clone()); } - let request = LSPS2Request::GetInfo(GetInfoRequest { token }); + let request = LSPS2Request::GetInfo(LSPS2GetInfoRequest { token }); let msg = LSPS2Message::Request(request_id.clone(), request).into(); self.pending_messages.enqueue(&counterparty_node_id, msg); @@ -181,7 +181,7 @@ where } fn handle_get_info_response( - &self, request_id: RequestId, counterparty_node_id: &PublicKey, result: GetInfoResponse, + &self, request_id: RequestId, counterparty_node_id: &PublicKey, result: LSPS2GetInfoResponse, ) -> Result<(), LightningError> { let outer_state_lock = self.per_peer_state.read().unwrap(); match outer_state_lock.get(counterparty_node_id) { @@ -198,7 +198,7 @@ where }); } - self.pending_events.enqueue(Event::LSPS2Client( + self.pending_events.enqueue(LSPSEvent::LSPS2Client( LSPS2ClientEvent::OpeningParametersReady { request_id, counterparty_node_id: *counterparty_node_id, @@ -264,7 +264,7 @@ where })?; if let Ok(intercept_scid) = result.jit_channel_scid.to_scid() { - self.pending_events.enqueue(Event::LSPS2Client( + self.pending_events.enqueue(LSPSEvent::LSPS2Client( LSPS2ClientEvent::InvoiceParametersReady { request_id, counterparty_node_id: *counterparty_node_id, diff --git a/lightning-liquidity/src/lsps2/msgs.rs b/lightning-liquidity/src/lsps2/msgs.rs index f7c0df9db06..efa57dd4065 100644 --- a/lightning-liquidity/src/lsps2/msgs.rs +++ b/lightning-liquidity/src/lsps2/msgs.rs @@ -27,7 +27,7 @@ pub(crate) const LSPS2_BUY_REQUEST_PAYMENT_SIZE_TOO_LARGE_ERROR_CODE: i32 = 203; #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] /// A request made to an LSP to learn their current channel fees and parameters. -pub struct GetInfoRequest { +pub struct LSPS2GetInfoRequest { /// An optional token to provide to the LSP. pub token: Option, } @@ -106,9 +106,9 @@ pub struct OpeningFeeParams { pub promise: String, } -/// A response to a [`GetInfoRequest`] +/// A response to a [`LSPS2GetInfoRequest`] #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct GetInfoResponse { +pub struct LSPS2GetInfoResponse { /// A set of opening fee parameters. pub opening_fee_params_menu: Vec, } @@ -164,7 +164,7 @@ pub struct BuyResponse { /// An enum that captures all the valid JSON-RPC requests in the LSPS2 protocol. pub enum LSPS2Request { /// A request to learn an LSP's channel fees and parameters. - GetInfo(GetInfoRequest), + GetInfo(LSPS2GetInfoRequest), /// A request to buy a JIT channel from an LSP. Buy(BuyRequest), } @@ -173,7 +173,7 @@ pub enum LSPS2Request { /// An enum that captures all the valid JSON-RPC responses in the LSPS2 protocol. pub enum LSPS2Response { /// A successful response to a [`LSPS2Request::GetInfo`] request. - GetInfo(GetInfoResponse), + GetInfo(LSPS2GetInfoResponse), /// An error response to a [`LSPS2Request::GetInfo`] request. GetInfoError(ResponseError), /// A successful response to a [`LSPS2Request::Buy`] request. diff --git a/lightning-liquidity/src/lsps2/service.rs b/lightning-liquidity/src/lsps2/service.rs index d4682a9b346..c1cd665d4ca 100644 --- a/lightning-liquidity/src/lsps2/service.rs +++ b/lightning-liquidity/src/lsps2/service.rs @@ -9,7 +9,7 @@ //! Contains the main LSPS2 server-side object, [`LSPS2ServiceHandler`]. -use crate::events::{Event, EventQueue}; +use crate::events::{LSPSEvent, EventQueue}; use crate::lsps0::ser::{ LSPSMessage, ProtocolMessageHandler, RequestId, ResponseError, JSONRPC_INTERNAL_ERROR_ERROR_CODE, JSONRPC_INTERNAL_ERROR_ERROR_MESSAGE, @@ -40,7 +40,7 @@ use core::ops::Deref; use core::sync::atomic::{AtomicUsize, Ordering}; use crate::lsps2::msgs::{ - BuyRequest, BuyResponse, GetInfoRequest, GetInfoResponse, LSPS2Message, LSPS2Request, + BuyRequest, BuyResponse, LSPS2GetInfoRequest, LSPS2GetInfoResponse, LSPS2Message, LSPS2Request, LSPS2Response, OpeningFeeParams, RawOpeningFeeParams, LSPS2_BUY_REQUEST_INVALID_OPENING_FEE_PARAMS_ERROR_CODE, LSPS2_BUY_REQUEST_PAYMENT_SIZE_TOO_LARGE_ERROR_CODE, @@ -550,7 +550,7 @@ macro_rules! get_or_insert_peer_state_entry { } /// The main object allowing to send and receive LSPS2 messages. -pub struct LSPS2ServiceHandler +pub struct LSPS2ServiceHandler where CM::Target: AChannelManager, { @@ -564,7 +564,7 @@ where config: LSPS2ServiceConfig, } -impl LSPS2ServiceHandler +impl LSPS2ServiceHandler where CM::Target: AChannelManager, { @@ -658,7 +658,7 @@ where match self.remove_pending_request(&mut peer_state_lock, &request_id) { Some(LSPS2Request::GetInfo(_)) => { - let response = LSPS2Response::GetInfo(GetInfoResponse { + let response = LSPS2Response::GetInfo(LSPS2GetInfoResponse { opening_fee_params_menu: opening_fee_params_menu .into_iter() .map(|param| { @@ -806,7 +806,7 @@ where }; match jit_channel.htlc_intercepted(htlc) { Ok(Some(HTLCInterceptedAction::OpenChannel(open_channel_params))) => { - let event = Event::LSPS2Service(LSPS2ServiceEvent::OpenChannel { + let event = LSPSEvent::LSPS2Service(LSPS2ServiceEvent::OpenChannel { their_network_key: counterparty_node_id.clone(), amt_to_forward_msat: open_channel_params.amt_to_forward_msat, opening_fee_msat: open_channel_params.opening_fee_msat, @@ -1076,7 +1076,7 @@ where } fn handle_get_info_request( - &self, request_id: RequestId, counterparty_node_id: &PublicKey, params: GetInfoRequest, + &self, request_id: RequestId, counterparty_node_id: &PublicKey, params: LSPS2GetInfoRequest, ) -> Result<(), LightningError> { let (result, response) = { let mut outer_state_lock = self.per_peer_state.write().unwrap(); @@ -1091,7 +1091,7 @@ where request, ) { (Ok(()), msg) => { - let event = Event::LSPS2Service(LSPS2ServiceEvent::GetInfo { + let event = LSPSEvent::LSPS2Service(LSPS2ServiceEvent::GetInfo { request_id, counterparty_node_id: *counterparty_node_id, token: params.token, @@ -1210,7 +1210,7 @@ where request, ) { (Ok(()), msg) => { - let event = Event::LSPS2Service(LSPS2ServiceEvent::BuyRequest { + let event = LSPSEvent::LSPS2Service(LSPS2ServiceEvent::BuyRequest { request_id, counterparty_node_id: *counterparty_node_id, opening_fee_params: params.opening_fee_params, @@ -1345,7 +1345,7 @@ where } } -impl ProtocolMessageHandler for LSPS2ServiceHandler +impl ProtocolMessageHandler for LSPS2ServiceHandler where CM::Target: AChannelManager, { diff --git a/lightning-liquidity/src/manager.rs b/lightning-liquidity/src/manager.rs index a4c13033370..7b01c6cfcb6 100644 --- a/lightning-liquidity/src/manager.rs +++ b/lightning-liquidity/src/manager.rs @@ -1,4 +1,4 @@ -use crate::events::{Event, EventQueue}; +use crate::events::{LSPSEvent, EventQueue}; use crate::lsps0::client::LSPS0ClientHandler; use crate::lsps0::msgs::LSPS0Message; use crate::lsps0::ser::{ @@ -329,7 +329,7 @@ where { /// /// [`MAX_EVENT_QUEUE_SIZE`]: crate::events::MAX_EVENT_QUEUE_SIZE #[cfg(feature = "std")] - pub fn wait_next_event(&self) -> Event { + pub fn wait_next_event(&self) -> LSPSEvent { self.pending_events.wait_next_event() } @@ -342,7 +342,7 @@ where { /// [`MAX_EVENT_QUEUE_SIZE`] has been reached. /// /// [`MAX_EVENT_QUEUE_SIZE`]: crate::events::MAX_EVENT_QUEUE_SIZE - pub fn next_event(&self) -> Option { + pub fn next_event(&self) -> Option { self.pending_events.next_event() } @@ -355,7 +355,7 @@ where { /// [`MAX_EVENT_QUEUE_SIZE`] has been reached. /// /// [`MAX_EVENT_QUEUE_SIZE`]: crate::events::MAX_EVENT_QUEUE_SIZE - pub async fn next_event_async(&self) -> Event { + pub async fn next_event_async(&self) -> LSPSEvent { self.pending_events.next_event_async().await } @@ -368,7 +368,7 @@ where { /// [`MAX_EVENT_QUEUE_SIZE`] has been reached. /// /// [`MAX_EVENT_QUEUE_SIZE`]: crate::events::MAX_EVENT_QUEUE_SIZE - pub fn get_and_clear_pending_events(&self) -> Vec { + pub fn get_and_clear_pending_events(&self) -> Vec { self.pending_events.get_and_clear_pending_events() } diff --git a/lightning-liquidity/tests/lsps2_integration_tests.rs b/lightning-liquidity/tests/lsps2_integration_tests.rs index 92e172606ab..640307b596a 100644 --- a/lightning-liquidity/tests/lsps2_integration_tests.rs +++ b/lightning-liquidity/tests/lsps2_integration_tests.rs @@ -4,7 +4,7 @@ mod common; use common::{create_service_and_client_nodes, get_lsps_message, Node}; -use lightning_liquidity::events::Event; +use lightning_liquidity::events::LSPSEvent; use lightning_liquidity::lsps2::client::LSPS2ClientConfig; use lightning_liquidity::lsps2::event::{LSPS2ClientEvent, LSPS2ServiceEvent}; use lightning_liquidity::lsps2::msgs::RawOpeningFeeParams; @@ -113,7 +113,7 @@ fn invoice_generation_flow() { let get_info_event = service_node.liquidity_manager.next_event().unwrap(); match get_info_event { - Event::LSPS2Service(LSPS2ServiceEvent::GetInfo { + LSPSEvent::LSPS2Service(LSPS2ServiceEvent::GetInfo { request_id, counterparty_node_id, token, @@ -151,7 +151,7 @@ fn invoice_generation_flow() { let opening_params_event = client_node.liquidity_manager.next_event().unwrap(); let opening_fee_params = match opening_params_event { - Event::LSPS2Client(LSPS2ClientEvent::OpeningParametersReady { + LSPSEvent::LSPS2Client(LSPS2ClientEvent::OpeningParametersReady { request_id, counterparty_node_id, opening_fee_params_menu, @@ -175,7 +175,7 @@ fn invoice_generation_flow() { let buy_event = service_node.liquidity_manager.next_event().unwrap(); match buy_event { - Event::LSPS2Service(LSPS2ServiceEvent::BuyRequest { + LSPSEvent::LSPS2Service(LSPS2ServiceEvent::BuyRequest { request_id, counterparty_node_id, opening_fee_params: ofp, @@ -210,7 +210,7 @@ fn invoice_generation_flow() { let invoice_params_event = client_node.liquidity_manager.next_event().unwrap(); match invoice_params_event { - Event::LSPS2Client(LSPS2ClientEvent::InvoiceParametersReady { + LSPSEvent::LSPS2Client(LSPS2ClientEvent::InvoiceParametersReady { request_id, counterparty_node_id, intercept_scid: iscid,