-
Notifications
You must be signed in to change notification settings - Fork 405
Type Renames for lightning-liquidity
bindings
#3574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
546559f
db41005
f3085bb
3e87194
5be9c1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,12 +11,12 @@ | |
|
||
use super::event::LSPS1ClientEvent; | ||
use super::msgs::{ | ||
CreateOrderRequest, CreateOrderResponse, GetInfoRequest, GetInfoResponse, GetOrderRequest, | ||
CreateOrderRequest, CreateOrderResponse, LSPS1GetInfoRequest, LSPS1GetInfoResponse, GetOrderRequest, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we have to do so, can we at least rename all LSPS1 and LSPS2 message types accordingly? I.e., please prefix everything, not just the types that might clash. Also note to adjust all the testcases accordingly. |
||
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, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above: let's rename the world. |
||
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, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's fine for now, but given that we eventually might want to get away from
LSPS
nomenclature, we could consider naming it differently (LiquidityEvent
?). Then again, moving away fromLSPS
will be a larger refactor at some point anyways, so might as well rename it accordingly again at that point.