Skip to content

Commit

Permalink
cln_plugin: Configure "dynamic" field in "getmanifest" message
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmoon authored and whitslack committed Oct 21, 2022
1 parent 8c98458 commit 786ebf9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ where
configuration: Option<Configuration>,
rpcmethods: HashMap<String, RpcMethod<S>>,
subscriptions: HashMap<String, Subscription<S>>,
dynamic: bool,
}

impl<S, I, O> Builder<S, I, O>
Expand All @@ -66,6 +67,7 @@ where
options: vec![],
configuration: None,
rpcmethods: HashMap::new(),
dynamic: false,
}
}

Expand Down Expand Up @@ -142,6 +144,12 @@ where
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,
/// RPC methods and subscribe to hooks, and then process the
/// initialization, configuring the plugin.
Expand Down Expand Up @@ -280,6 +288,7 @@ where
subscriptions: self.subscriptions.keys().map(|s| s.clone()).collect(),
hooks: self.hooks.keys().map(|s| s.clone()).collect(),
rpcmethods,
dynamic: self.dynamic,
}
}

Expand Down
1 change: 1 addition & 0 deletions plugins/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ pub(crate) struct GetManifestResponse {
pub(crate) rpcmethods: Vec<RpcMethod>,
pub(crate) subscriptions: Vec<String>,
pub(crate) hooks: Vec<String>,
pub(crate) dynamic: bool,
}

#[derive(Serialize, Default, Debug)]
Expand Down

0 comments on commit 786ebf9

Please sign in to comment.