lightning icon indicating copy to clipboard operation
lightning copied to clipboard

plugin: make the plugin aware of deprecated api flag

Open vincenzopalazzo opened this issue 1 year ago • 1 comments

This PR put the deprecated apis flag inside the plugin init payload to give the possibility to a plugin to be aware of some deprecated API, and more important to adopt the same deprecated workflow of core lightning in case this plugin will proxy some cln command.

Use case covered:

  • Give the plugin the possibility to use old API if available, or avoid to use it. eg: splitting listpeers in 2 different command.
  • Be able to deprecated some field in the plugin and follow the same rules of cln.

Changelog-Added: plugin: add deprecated api flag in the plugin init method.

Release target > 0.12.0

vincenzopalazzo avatar Aug 17 '22 19:08 vincenzopalazzo

It's already in the "getmanifest" call:

	json_add_bool(req->stream, "allow-deprecated-apis", deprecated_apis);

Which is often where it's needed (you might not want to register deprecated apis at all).

rustyrussell avatar Aug 18 '22 00:08 rustyrussell

Ah!

The getmanifest method is required for all plugins and will be called on startup with optional parameters (in particular, it may have allow-deprecated-apis: false, but you should accept, and ignore, other parameters).

I looked only to the payload :/ thanks for he catch!

vincenzopalazzo avatar Aug 18 '22 08:08 vincenzopalazzo