cln_plugin: custommessages in get_manifest

This commit is contained in:
Erik De Smedt 2024-01-17 15:09:03 +01:00 committed by Christian Decker
parent 42a7b63d30
commit 71c343e2d1
2 changed files with 12 additions and 0 deletions

View File

@ -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,
@ -122,6 +123,7 @@ where
rpcmethods: HashMap::new(),
notifications: vec![],
dynamic: false,
custommessages : vec![],
logging: true,
}
}
@ -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.
@ -354,6 +363,7 @@ where
notifications: self.notifications.clone(),
dynamic: self.dynamic,
nonnumericids: true,
custommessages : self.custommessages.clone()
}
}

View File

@ -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)]