Skip to content

Commit ff31829

Browse files
Add error handling events for failed client requests
Add GetInfoFailed and BuyRequestFailed event variants to LSPS2ClientEvent to handle LSP error responses, similar to the OrderRequestFailed event added to LSPS1. Fixes #3459
1 parent c60459c commit ff31829

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

lightning-liquidity/src/lsps2/event.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//! Contains bLIP-52 / LSPS2 event types
1111
1212
use super::msgs::LSPS2OpeningFeeParams;
13-
use crate::lsps0::ser::LSPSRequestId;
13+
use crate::lsps0::ser::{LSPSRequestId, LSPSResponseError};
1414
use alloc::string::String;
1515
use alloc::vec::Vec;
1616

@@ -61,6 +61,40 @@ pub enum LSPS2ClientEvent {
6161
/// The initial payment size you specified.
6262
payment_size_msat: Option<u64>,
6363
},
64+
/// A request previously issued via [`LSPS2ClientHandler::request_opening_params`]
65+
/// failed as the LSP returned an error response.
66+
///
67+
/// [`LSPS2ClientHandler::request_opening_params`]: crate::lsps2::client::LSPS2ClientHandler::request_opening_params
68+
GetInfoFailed {
69+
/// The identifier of the issued LSPS2 `get_info` request, as returned by
70+
/// [`LSPS2ClientHandler::request_opening_params`].
71+
///
72+
/// This can be used to track which request this event corresponds to.
73+
///
74+
/// [`LSPS2ClientHandler::request_opening_params`]: crate::lsps2::client::LSPS2ClientHandler::request_opening_params
75+
request_id: LSPSRequestId,
76+
/// The node id of the LSP.
77+
counterparty_node_id: PublicKey,
78+
/// The error that was returned.
79+
error: LSPSResponseError,
80+
},
81+
/// A request previously issued via [`LSPS2ClientHandler::select_opening_params`]
82+
/// failed as the LSP returned an error response.
83+
///
84+
/// [`LSPS2ClientHandler::select_opening_params`]: crate::lsps2::client::LSPS2ClientHandler::select_opening_params
85+
BuyRequestFailed {
86+
/// The identifier of the issued LSPS2 `buy` request, as returned by
87+
/// [`LSPS2ClientHandler::select_opening_params`].
88+
///
89+
/// This can be used to track which request this event corresponds to.
90+
///
91+
/// [`LSPS2ClientHandler::select_opening_params`]: crate::lsps2::client::LSPS2ClientHandler::select_opening_params
92+
request_id: LSPSRequestId,
93+
/// The node id of the LSP.
94+
counterparty_node_id: PublicKey,
95+
/// The error that was returned.
96+
error: LSPSResponseError,
97+
},
6498
}
6599

66100
/// An event which an bLIP-52 / LSPS2 server should take some action in response to.

0 commit comments

Comments
 (0)