Skip to content
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

Some minor changes in the CLN crates #5493

Merged
merged 5 commits into from
Sep 25, 2022

Conversation

cdecker
Copy link
Member

@cdecker cdecker commented Aug 3, 2022

These are based on feedback and dogfooding experiences, please keep them coming 😉

@cdecker cdecker added this to the v22.10 milestone Aug 3, 2022
@cdecker cdecker force-pushed the cln-plugin-rework branch 2 times, most recently from dd4a10c to e7be122 Compare August 3, 2022 15:32
@cdecker cdecker marked this pull request as ready for review September 15, 2022 09:41
@cdecker cdecker force-pushed the cln-plugin-rework branch 8 times, most recently from 5065dba to cca27a9 Compare September 22, 2022 13:27
@cdecker cdecker changed the title Some minor changes in the cln crates Some minor changes in the CLN crates Sep 22, 2022
@cdecker cdecker force-pushed the cln-plugin-rework branch 2 times, most recently from ec90055 to fd5adbc Compare September 23, 2022 08:35
We had a bit of a chicken-and-egg problem, where we instantiated the
`state` to be managed by the `Plugin` during the very first step when
creating the `Builder`, but then the state might depend on the
configuration we only get later. This would force developers to add
placeholders in the form of `Option` into the state, when really
they'd never be none after configuring.

This defers the binding until after we get the configuration and
cleans up the semantics:

 - `Builder`: declare options, hooks, etc
 - `ConfiguredPlugin`: we have exchanged the handshake with
   `lightningd`, now we can construct the `state` accordingly
 - `Plugin`: Running instance of the plugin

Changelog-Changed: cln-plugin: Moved the state binding to the plugin until after the configuration step
We filter based on the environment variable `CLN_PLUGIN_LOG`,
defaulting to `info` as that is not as noisy as `debug` or `trace`, at
least libraries will not spam us too heavily.

Changelog-Added cln-plugin: The logs level from cln-plugins can be configured by the `CLN_PLUGIN_LOG` environment variable.
I wanted to debug why we weren't getting some log messages, and this
makes that a bit easier in future.
We needed to clone a lot since we were using a non-mutable borrow of
the cln-rpc version to then create the cln-grpc version. This alone
reduces the number of allocations of the `listpeers` test from 52
allocations to 38.
@cdecker cdecker merged commit 437ae11 into ElementsProject:master Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant