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

cln-grpc: do not generate cerficates when no autostart. #6755

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
3 changes: 2 additions & 1 deletion plugins/grpc-plugin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ async fn main() -> Result<()> {
let path = Path::new("lightning-rpc");

let directory = std::env::current_dir()?;
let (identity, ca_cert) = tls::init(&directory)?;

let plugin = match Builder::new(tokio::io::stdin(), tokio::io::stdout())
.option(options::ConfigOption::new(
Expand Down Expand Up @@ -48,6 +47,8 @@ async fn main() -> Result<()> {
Some(o) => return Err(anyhow!("grpc-port is not a valid integer: {:?}", o)),
};

let (identity, ca_cert) = tls::init(&directory)?;

let state = PluginState {
rpc_path: path.into(),
identity,
Expand Down
6 changes: 6 additions & 0 deletions tests/test_cln_rs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pytest
import subprocess
import os
import re

# Skip the entire module if we don't have Rust.
pytestmark = pytest.mark.skipif(
Expand Down Expand Up @@ -178,11 +179,16 @@ def test_grpc_generate_certificate(node_factory):

def test_grpc_no_auto_start(node_factory):
"""Ensure that we do not start cln-grpc unless a port is configured.
Also check that we do not generate certificates.
"""
l1 = node_factory.get_node()

wait_for(lambda: [p for p in l1.rpc.plugin('list')['plugins'] if 'cln-grpc' in p['name']] == [])
assert l1.daemon.is_in_log(r'plugin-cln-grpc: Killing plugin: disabled itself at init')
p = Path(l1.daemon.lightning_dir) / TEST_NETWORK
files = os.listdir(p)
pem_files = [f for f in files if re.match(r".*\.pem$", f)]
assert pem_files == []


def test_grpc_wrong_auth(node_factory):
Expand Down
Loading