-
Notifications
You must be signed in to change notification settings - Fork 886
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: Save "configuration" from "init" method #5279
Conversation
ba92cef
to
f6bca33
Compare
f6bca33
to
9c3f2c9
Compare
Added a unittest as separate commit to make sure the "init" message (used this example) can be parsed. Not sure if this is helpful or not. |
plugins/src/lib.rs
Outdated
pub struct Configuration { | ||
#[serde(rename = "lightning-dir")] | ||
pub lightning_dir: String, | ||
} |
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.
If we keep this struct, what else should go in it?
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.
Here the docs https://lightning.readthedocs.io/PLUGINS.html#the-init-method and if you want to do a copy and paste https://github.com/laanwj/rust-clightning-rpc/blob/92912c8a5318624b2c9684676a0f697b4a38432e/plugin/src/commands/types.rs#L25-L51
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.
overall LGTM, just take a decision if we want use an HasMap or a Struct for the configuration
As you mentioned above making these things we have control over as strongly typed as possible would be a good idea. So I'd vote in favor of the |
a3f8c1c
to
01549e5
Compare
Added the rest of the fields to |
It is missing the Changelog in the body commit, maybe |
01549e5
to
1c39564
Compare
Added changelog entry @vincenzopalazzo |
BTW I've invited you to project as a reader. This should mean CI runs for you... |
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.
Only a small comment, and LGTM.
With the next commit, we will see with the CI will be happy!
1c39564
to
1350317
Compare
Represents the "configuration" part of the "init" message during plugin initialization. Changelog-Added: cln_plugin: persist cln configuration from init msg
1350317
to
eb9e7f5
Compare
The tests seem to be failing because this match is failing with my In my unittest I'm using exactly this JSON and it passes. Why is it failing in the python test in CI? It does seem that the example JSON in the link above is different from what the CI test is sending. For example, the |
These are only populated if a proxy was specified, see lightningd/plugin.c:1855, so we were getting upset when we expected them and they weren't set.
ACK 9e912f8 |
cln-plugin
throws away the "configuration" field from the "init" message.