Skip to content

Commit

Permalink
cln_plugin: custommessages in get_manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikDeSmedt authored and cdecker committed Jan 31, 2024
1 parent 42a7b63 commit 71c343e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions plugins/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ where
rpcmethods: HashMap<String, RpcMethod<S>>,
subscriptions: HashMap<String, Subscription<S>>,
notifications: Vec<NotificationTopic>,
custommessages : Vec<u16>,
dynamic: bool,
// Do we want the plugin framework to automatically register a logging handler?
logging: bool,
Expand Down Expand Up @@ -122,6 +123,7 @@ where
rpcmethods: HashMap::new(),
notifications: vec![],
dynamic: false,
custommessages : vec![],
logging: true,
}
}
Expand Down Expand Up @@ -228,6 +230,13 @@ where
self
}

/// Tells lightningd explicitly to allow custommmessages of the provided
/// type
pub fn custommessages(mut self, custommessages : Vec<u16>) -> Self {
self.custommessages = custommessages;
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 @@ -354,6 +363,7 @@ where
notifications: self.notifications.clone(),
dynamic: self.dynamic,
nonnumericids: true,
custommessages : self.custommessages.clone()
}
}

Expand Down
2 changes: 2 additions & 0 deletions plugins/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ pub(crate) struct GetManifestResponse {
pub(crate) hooks: Vec<String>,
pub(crate) dynamic: bool,
pub(crate) nonnumericids: bool,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub(crate) custommessages : Vec<u16>
}

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

0 comments on commit 71c343e

Please sign in to comment.