rgb-cln/plugins
ZmnSCPxj jxPCSnmZ d4690358d9 plugins/libplugin.c: Allow freeing notification `struct command *`.
We always allocate a new `struct command` when we get a full JSON
object from stdin:

b2df01dc73/plugins/libplugin.c (L1229-L1233)

If it happens to be a notification, we pass the `struct command` to
the handler, and not free it ourselves:

b2df01dc73/plugins/libplugin.c (L1270-L1275)

There are only nine points in `plugins/libplugin.c` where we `tal_free`
anything, and only one of them frees a `struct command`:

b2df01dc73/plugins/libplugin.c (L224-L234)

The above function `command_complete` is not appropriate for
notification handlers; the above function sends out a response
to our stdout, which a notification handler should not do.

However, as-is, it does mean that notification handling leaks
`struct command` objects, which can be problematic if we ever
have future built-in plugins which are significantly more
dependent on notifications.

This commit changes notification handlers to return
`struct command_result *`, because possibly in the future
notification handlers may want to perform `send_outreq`, so we
might as well use our standard convention for callbacks, and
to encourage future developers to check how to properly
terminate notification handlers (and free up the
`struct command`).

We also now provide a `notification_handled` function which a
notification handler must eventually call, as well as a
`notification_handler_pending` which is just a snowclone of
`command_still_pending`.
2021-10-08 14:40:04 +10:30
..
spender plugins/libplugin.c: Allow freeing notification `struct command *`. 2021-10-08 14:40:04 +10:30
test common/autodata: use instead of ccan/autodata 2021-09-21 18:04:43 +02:00
.gitignore sort alphabetically 2021-06-28 14:43:47 +09:30
Makefile common/autodata: use instead of ccan/autodata 2021-09-21 18:04:43 +02:00
README.md doc: fix wording in plugins/README.md 2020-01-06 12:57:59 +01:00
autoclean.c cleanup: remove unneeded includes in C files. 2021-09-17 09:43:22 +09:30
bcli.c bcli: Accept "already in chain" errors as success 2021-09-22 09:08:48 +09:30
fetchinvoice.c fetchinvoice: handle modern onion_message reply. 2021-10-04 11:58:31 +02:00
funder.c plugins/libplugin.c: Allow freeing notification `struct command *`. 2021-10-08 14:40:04 +10:30
funder_policy.c cleanup: remove unneeded includes in C files. 2021-09-17 09:43:22 +09:30
funder_policy.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
keysend.c cleanup: remove unneeded includes in C files. 2021-09-17 09:43:22 +09:30
libplugin-pay.c pay: Fix wrong result being returned by pay 2021-09-22 09:08:48 +09:30
libplugin-pay.h jsonrpc: Simplify the state decision of `listpays` 2021-09-22 09:08:48 +09:30
libplugin.c plugins/libplugin.c: Allow freeing notification `struct command *`. 2021-10-08 14:40:04 +10:30
libplugin.h plugins/libplugin.c: Allow freeing notification `struct command *`. 2021-10-08 14:40:04 +10:30
offers.c offers: send a modern onion reply in response to a modern request. 2021-10-04 11:58:31 +02:00
offers.h offers: send a modern onion reply in response to a modern request. 2021-10-04 11:58:31 +02:00
offers_inv_hook.c offers: send a modern onion reply in response to a modern request. 2021-10-04 11:58:31 +02:00
offers_inv_hook.h offers: send a modern onion reply in response to a modern request. 2021-10-04 11:58:31 +02:00
offers_invreq_hook.c offers: send a modern onion reply in response to a modern request. 2021-10-04 11:58:31 +02:00
offers_invreq_hook.h offers: send a modern onion reply in response to a modern request. 2021-10-04 11:58:31 +02:00
offers_offer.c cleanup: remove unneeded includes in C files. 2021-09-17 09:43:22 +09:30
offers_offer.h offers: make `decode` command available even without experimental-offers. 2021-08-02 13:23:31 -04:00
pay.c plugin: Adding status to the pay plugin 2021-09-22 16:23:24 +09:30
topology.c cleanup: remove unneeded includes in C files. 2021-09-17 09:43:22 +09:30
txprepare.c cleanup: remove unneeded includes in C files. 2021-09-17 09:43:22 +09:30

README.md

Plugin Directory

Any file in this directory which is executable and whose name only consists of alphanumeric characters, space, '.', '-' or '_' will be automatically loaded when lightningd starts (unless suppressed with commandline options).