-
Notifications
You must be signed in to change notification settings - Fork 912
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-plugin: Add dynamic configs and a callback for changes #7293
cln-plugin: Add dynamic configs and a callback for changes #7293
Conversation
6ae3eb4
to
952da34
Compare
That's me alright, bad boy for life 🤣 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice change, just a minor suggestion to make dynamic()
return a copy so we can just chain the invocations as if it were a Builder.
ACK 952da34
952da34
to
ac263e1
Compare
ACK ac263e1 |
btw CLN printing broken logs if the plugin does not like the new option value and returns an Err() as a Result is a bit much imo:
should be UNUSUAL, no? |
and on the console you only get a generic error instead of the one from the plugin:
You have to then look at the broken log entry to get the error reported by the plugin. This could be improved! |
So after the meeting and a private coding session with rusty it turned out that it works as it should with the python framework. So this is a skill issue on my part or an actual issue with the rust framework. pub async fn setconfig_callback(
plugin: Plugin<PluginState>,
args: serde_json::Value,
) -> Result<serde_json::Value, Error> {
return Err(anyhow!(json!(RpcError {
code: Some(-1),
message: "bad thing".to_string(),
data: None
})));
|
Changelog-Added: cln-plugin: Add dynamic configs and a callback for changes
ac263e1
to
a3b1baa
Compare
Ok , so
I've added a commit where error messages get the proper (non-) escaping string. With that we get:
|
I want this in cln-plugin: #7289
So this is my take for cln-plugin on it. The formatting changes are because @cdecker is not using
rustfmt
like a good boy and i noticed it too late, sorry. Some things get a bit weird here and there but overall it works!I wanted existing projects to not have to do any changes if they were using static options (so all of them up to now), that's why i added the dynamic switch as a function, instead of an extra argument to the
new_*
functions.Let me know what you think.