Skip to content

Commit ef6f609

Browse files
committed
lsps: Implement the transport layer for lsps0
For lsps0 we send JSON-RPC messages via custom messages over the lightning network. This commit adds a basic implementation based on custom messages.
1 parent 9639995 commit ef6f609

File tree

7 files changed

+559
-22
lines changed

7 files changed

+559
-22
lines changed

Cargo.lock

Lines changed: 3 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/lsps-plugin/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7+
anyhow = "1.0"
78
async-trait = "0.1"
8-
dashmap = "6.1"
9+
cln-plugin = { version = "0.4", path = "../" }
10+
cln-rpc = { version = "0.4", path = "../../cln-rpc" }
911
hex = "0.4"
1012
log = "0.4"
1113
rand = "0.9"

plugins/lsps-plugin/src/jsonrpc/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ impl Error {
3333

3434
#[derive(Error, Debug)]
3535
pub enum TransportError {
36+
#[error("Timeout")]
37+
Timeout,
3638
#[error("Other error: {0}")]
3739
Other(String),
3840
}

plugins/lsps-plugin/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
mod jsonrpc;
2+
mod lsps0;

plugins/lsps-plugin/src/lsps0/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod model;
2+
pub mod transport;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use serde::{Deserialize, Serialize};
2+
3+
use crate::jsonrpc::JsonRpcRequest;
4+
5+
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6+
pub struct Lsps0listProtocolsRequest {}
7+
8+
impl JsonRpcRequest for Lsps0listProtocolsRequest {
9+
const METHOD: &'static str = "lsps0.list_protocols";
10+
}
11+
12+
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
13+
pub struct Lsps0listProtocolsResponse {
14+
pub protocols: Vec<u8>,
15+
}

0 commit comments

Comments
 (0)