Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Upgrade cln-* crates" #480

Merged
merged 2 commits into from
Jul 11, 2024
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
17 changes: 6 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ members = [
[workspace.dependencies]
anyhow = "1"
env_logger = "0.10"
cln-grpc = "0.1.9"
cln-rpc = "0.1.9"
cln-plugin = "0.1.9"
cln-grpc = "=0.1.8"
cln-rpc = "0.1.8"
cln-plugin = "0.1.8"

vls-core = "^0.11.0"
vls-persist = "^0.11.0"
Expand Down
13 changes: 13 additions & 0 deletions libs/gl-client-py/glclient/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,19 @@ def del_datastore(
bytes(self.inner.call(uri, bytes(req)))
)

def del_expired_invoice(
self,
maxexpirytime=None
):
uri = "/cln.Node/DelExpiredInvoice"
req = clnpb.DelexpiredinvoiceRequest(
maxexpirytime=maxexpirytime
).SerializeToString()
res = clnpb.DelexpiredinvoiceResponse
return res.FromString(
bytes(self.inner.call(uri, bytes(req)))
)

def del_invoice(
self,
label,
Expand Down
1 change: 1 addition & 0 deletions libs/gl-client/src/signer/model/cln.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub fn decode_request(uri: &str, p: &[u8]) -> anyhow::Result<Request> {
"/cln.Node/Datastore" => Request::Datastore(DatastoreRequest::decode(p)?),
"/cln.Node/CreateOnion" => Request::CreateOnion(CreateonionRequest::decode(p)?),
"/cln.Node/DelDatastore" => Request::DelDatastore(DeldatastoreRequest::decode(p)?),
"/cln.Node/DelExpiredInvoice" => Request::DelExpiredInvoice(DelexpiredinvoiceRequest::decode(p)?),
"/cln.Node/DelInvoice" => Request::DelInvoice(DelinvoiceRequest::decode(p)?),
"/cln.Node/Invoice" => Request::Invoice(InvoiceRequest::decode(p)?),
"/cln.Node/ListDatastore" => Request::ListDatastore(ListdatastoreRequest::decode(p)?),
Expand Down
1 change: 1 addition & 0 deletions libs/gl-client/src/signer/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub enum Request {
Datastore(cln::DatastoreRequest),
CreateOnion(cln::CreateonionRequest),
DelDatastore(cln::DeldatastoreRequest),
DelExpiredInvoice(cln::DelexpiredinvoiceRequest),
DelInvoice(cln::DelinvoiceRequest),
Invoice(cln::InvoiceRequest),
ListDatastore(cln::ListdatastoreRequest),
Expand Down
2 changes: 1 addition & 1 deletion libs/gl-client/src/signer/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl Resolver {
// Manually calling preapproveinvoice should
// always be allowed. The bolt11 string have to
// match.
l.invstring.0 == r.bolt11.as_bytes()
l.invstring.0 == r.bolt11().as_bytes()
}
(_, _) => false,
};
Expand Down
2 changes: 1 addition & 1 deletion libs/gl-plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ base64 = "0.21.7"
bytes = { version = "1", features = ["serde"] }
clightningrpc = "0.2"
cln-grpc = { workspace = true, features = ["server"] }
cln-plugin = { workspace = true }
cln-plugin = "^0.1"
cln-rpc = { workspace = true }
env_logger = "^0.7.1"
futures = "0.3"
Expand Down
26 changes: 11 additions & 15 deletions libs/gl-plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,12 @@ async fn on_peer_connected(plugin: Plugin, v: serde_json::Value) -> Result<serde
async fn on_openchannel(plugin: Plugin, v: serde_json::Value) -> Result<serde_json::Value> {
debug!("Received an openchannel request: {:?}", v);
let mut rpc = cln_rpc::ClnRpc::new(plugin.configuration().rpc_file).await?;

let req = cln_rpc::model::requests::ListdatastoreRequest {
key: Some(vec!["glconf".to_string(), "request".to_string()]),

let req = cln_rpc::model::requests::ListdatastoreRequest{
key: Some(vec![
"glconf".to_string(),
"request".to_string(),
])
};

let res = rpc.call_typed(&req).await;
Expand All @@ -171,17 +174,13 @@ async fn on_openchannel(plugin: Plugin, v: serde_json::Value) -> Result<serde_js
if !res.datastore.is_empty() {
match &res.datastore[0].string {
Some(serialized_request) => {
match _parse_gl_config_from_serialized_request(
serialized_request.to_string(),
) {
match _parse_gl_config_from_serialized_request(serialized_request.to_string()) {
Some(gl_config) => {
return Ok(
json!({"result": "continue", "close_to": gl_config.close_to_addr}),
);
return Ok(json!({"result": "continue", "close_to": gl_config.close_to_addr}));
}
None => {
debug!("Failed to parse the GlConfig from the serialized request's payload");
}
}
}
}
None => {
Expand All @@ -190,13 +189,10 @@ async fn on_openchannel(plugin: Plugin, v: serde_json::Value) -> Result<serde_js
}
}

return Ok(json!({"result": "continue"}));
return Ok(json!({"result": "continue"}))
}
Err(e) => {
log::debug!(
"An error occurred while searching for a custom close_to address: {}",
e
);
log::debug!("An error occurred while searching for a custom close_to address: {}", e);
Ok(json!({"result": "continue"}))
}
}
Expand Down
4 changes: 0 additions & 4 deletions libs/gl-plugin/src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pub struct PluginNodeServer {
pub rpc: Arc<Mutex<LightningClient>>,
rpc_path: PathBuf,
events: tokio::sync::broadcast::Sender<super::Event>,
notifications: tokio::sync::broadcast::Sender<cln_rpc::Notification>,
signer_state: Arc<Mutex<State>>,
grpc_binding: String,
signer_state_store: Arc<Mutex<Box<dyn StateStore>>>,
Expand Down Expand Up @@ -99,8 +98,6 @@ impl PluginNodeServer {

let rrpc = rpc.clone();

let (notifications, _) = tokio::sync::broadcast::channel(1);

let s = PluginNodeServer {
ctx,
tls,
Expand All @@ -111,7 +108,6 @@ impl PluginNodeServer {
signer_state: Arc::new(Mutex::new(signer_state)),
signer_state_store: Arc::new(Mutex::new(signer_state_store)),
grpc_binding: config.node_grpc_binding,
notifications,
};

tokio::spawn(async move {
Expand Down
Loading
Loading