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

Commit cbbe9fe

Browse files
authored
Merge pull request #112 from tnull/2024-02-drop-get-order-response
LSPS1: Drop `GetOrderResponse`, just use `CreateOrderResponse`
2 parents 93de7cd + 122cdb5 commit cbbe9fe

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

src/lsps1/client.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
use super::event::LSPS1ClientEvent;
1313
use super::msgs::{
1414
CreateOrderRequest, CreateOrderResponse, GetInfoRequest, GetInfoResponse, GetOrderRequest,
15-
GetOrderResponse, LSPS1Message, LSPS1Request, LSPS1Response, OptionsSupported, OrderId,
16-
OrderParams,
15+
LSPS1Message, LSPS1Request, LSPS1Response, OptionsSupported, OrderId, OrderParams,
1716
};
1817
use super::utils::is_valid;
1918
use crate::message_queue::MessageQueue;
@@ -560,7 +559,7 @@ where
560559
}
561560

562561
fn handle_get_order_response(
563-
&self, request_id: RequestId, counterparty_node_id: &PublicKey, params: GetOrderResponse,
562+
&self, request_id: RequestId, counterparty_node_id: &PublicKey, params: CreateOrderResponse,
564563
) -> Result<(), LightningError> {
565564
let outer_state_lock = self.per_peer_state.read().unwrap();
566565
match outer_state_lock.get(&counterparty_node_id) {

src/lsps1/msgs.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,6 @@ pub struct GetOrderRequest {
236236
pub order_id: OrderId,
237237
}
238238

239-
/// A response to an [`GetOrderRequest`].
240-
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
241-
pub struct GetOrderResponse {
242-
/// The response to the order request.
243-
pub response: CreateOrderResponse,
244-
}
245-
246239
/// An enum that captures all the valid JSON-RPC requests in the LSPS1 protocol.
247240
#[derive(Clone, Debug, PartialEq, Eq)]
248241
pub enum LSPS1Request {
@@ -266,7 +259,7 @@ pub enum LSPS1Response {
266259
/// An error response to a [`CreateOrderRequest`].
267260
CreateOrderError(ResponseError),
268261
/// A successful response to a [`GetOrderRequest`].
269-
GetOrder(GetOrderResponse),
262+
GetOrder(CreateOrderResponse),
270263
/// An error response to a [`GetOrderRequest`].
271264
GetOrderError(ResponseError),
272265
}

src/lsps1/service.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
use super::event::LSPS1ServiceEvent;
1313
use super::msgs::{
1414
ChannelInfo, CreateOrderRequest, CreateOrderResponse, GetInfoResponse, GetOrderRequest,
15-
GetOrderResponse, LSPS1Message, LSPS1Request, LSPS1Response, OptionsSupported, OrderId,
16-
OrderParams, OrderPayment, OrderState, LSPS1_CREATE_ORDER_REQUEST_ORDER_MISMATCH_ERROR_CODE,
15+
LSPS1Message, LSPS1Request, LSPS1Response, OptionsSupported, OrderId, OrderParams,
16+
OrderPayment, OrderState, LSPS1_CREATE_ORDER_REQUEST_ORDER_MISMATCH_ERROR_CODE,
1717
};
1818
use super::utils::is_valid;
1919
use crate::message_queue::MessageQueue;
@@ -375,16 +375,14 @@ where
375375
self.enqueue_response(
376376
&counterparty_node_id,
377377
request_id,
378-
LSPS1Response::GetOrder(GetOrderResponse {
379-
response: CreateOrderResponse {
380-
order_id,
381-
order: config.order.clone(),
382-
order_state,
383-
created_at: config.created_at,
384-
expires_at: config.expires_at,
385-
payment: config.payment.clone(),
386-
channel,
387-
},
378+
LSPS1Response::GetOrder(CreateOrderResponse {
379+
order_id,
380+
order: config.order.clone(),
381+
order_state,
382+
created_at: config.created_at,
383+
expires_at: config.expires_at,
384+
payment: config.payment.clone(),
385+
channel,
388386
}),
389387
)
390388
} else {

0 commit comments

Comments
 (0)