Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lightning-liquidity/src/lsps5/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ pub enum LSPS5ServiceEvent {
/// via their registered webhook.
///
/// The LSP should send an HTTP POST to the [`url`], using the
/// JSON-serialized [`notification`] as the body and including the `headers`.
/// If the HTTP request fails, the LSP may implement a retry policy according to its
/// implementation preferences.
/// JSON-serialized [`notification`] (via [`WebhookNotification::to_request_body`]) as the body
/// and including the `headers`. If the HTTP request fails, the LSP may implement a retry
/// policy according to its implementation preferences.
///
/// The notification is signed using the LSP's node ID to ensure authenticity
/// when received by the client. The client verifies this signature using
Expand Down
6 changes: 6 additions & 0 deletions lightning-liquidity/src/lsps5/msgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,12 @@ impl WebhookNotification {
pub fn onion_message_incoming() -> Self {
Self { method: WebhookNotificationMethod::LSPS5OnionMessageIncoming }
}

/// Encodes this notification into JSON which can be sent as the body of an HTTP request to
/// deliver the notification.
pub fn to_request_body(&self) -> String {
serde_json::to_string(self).unwrap()
}
}

impl Serialize for WebhookNotification {
Expand Down