cln_plugin: Configure "dynamic" field in "getmanifest" message

This commit is contained in:
Justin Moon
2022-07-10 13:28:42 +02:00
committed by Christian Decker
parent 71cd07ea61
commit 42783aaa92
2 changed files with 10 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ where
configuration: Option<Configuration>, configuration: Option<Configuration>,
rpcmethods: HashMap<String, RpcMethod<S>>, rpcmethods: HashMap<String, RpcMethod<S>>,
subscriptions: HashMap<String, Subscription<S>>, subscriptions: HashMap<String, Subscription<S>>,
dynamic: bool,
} }
impl<S, I, O> Builder<S, I, O> impl<S, I, O> Builder<S, I, O>
@@ -66,6 +67,7 @@ where
options: vec![], options: vec![],
configuration: None, configuration: None,
rpcmethods: HashMap::new(), rpcmethods: HashMap::new(),
dynamic: false,
} }
} }
@@ -142,6 +144,12 @@ where
self self
} }
/// Send true value for "dynamic" field in "getmanifest" response
pub fn dynamic(mut self) -> Builder<S, I, O> {
self.dynamic = true;
self
}
/// Communicate with `lightningd` to tell it about our options, /// Communicate with `lightningd` to tell it about our options,
/// RPC methods and subscribe to hooks, and then process the /// RPC methods and subscribe to hooks, and then process the
/// initialization, configuring the plugin. /// initialization, configuring the plugin.
@@ -280,6 +288,7 @@ where
subscriptions: self.subscriptions.keys().map(|s| s.clone()).collect(), subscriptions: self.subscriptions.keys().map(|s| s.clone()).collect(),
hooks: self.hooks.keys().map(|s| s.clone()).collect(), hooks: self.hooks.keys().map(|s| s.clone()).collect(),
rpcmethods, rpcmethods,
dynamic: self.dynamic,
} }
} }

View File

@@ -156,6 +156,7 @@ pub(crate) struct GetManifestResponse {
pub(crate) rpcmethods: Vec<RpcMethod>, pub(crate) rpcmethods: Vec<RpcMethod>,
pub(crate) subscriptions: Vec<String>, pub(crate) subscriptions: Vec<String>,
pub(crate) hooks: Vec<String>, pub(crate) hooks: Vec<String>,
pub(crate) dynamic: bool,
} }
#[derive(Serialize, Default, Debug)] #[derive(Serialize, Default, Debug)]