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

Commit 487b391

Browse files
expose list_protocols on lsp manager
1 parent bd49cce commit 487b391

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/transport/message_handler.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ where
8080
}
8181
}
8282

83+
/// List the LSP protocols a node supports
84+
///
85+
/// Will receive the response via a ListProtocols event
86+
pub fn list_protocols(&self, counterparty_node_id: PublicKey) {
87+
self.lsps0_message_handler.list_protocols(counterparty_node_id)
88+
}
89+
8390
/// Needs to be polled regularly to surface events generated by the various protocols
8491
pub fn get_and_clear_pending_events(&self) -> Vec<Event> {
8592
self.pending_events.lock().unwrap().drain(..).collect()

src/transport/protocol.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,13 @@ where
4040
RequestId(utils::hex_str(&bytes[0..16]))
4141
}
4242

43-
pub fn list_protocols(
44-
&self, counterparty_node_id: PublicKey,
45-
) -> Result<(), lightning::ln::msgs::LightningError> {
43+
pub fn list_protocols(&self, counterparty_node_id: PublicKey) {
4644
let msg = LSPS0Message::Request(
4745
self.generate_request_id(),
4846
LSPS0Request::ListProtocols(ListProtocolsRequest {}),
4947
);
5048

5149
self.enqueue_message(counterparty_node_id, msg);
52-
53-
Ok(())
5450
}
5551

5652
fn enqueue_message(&self, counterparty_node_id: PublicKey, message: LSPS0Message) {
@@ -195,7 +191,7 @@ mod tests {
195191
)
196192
.unwrap();
197193

198-
lsps0_handler.list_protocols(counterparty_node_id).unwrap();
194+
lsps0_handler.list_protocols(counterparty_node_id);
199195
let pending_messages = pending_messages.lock().unwrap();
200196

201197
assert_eq!(pending_messages.len(), 1);

0 commit comments

Comments
 (0)